summaryrefslogtreecommitdiff
path: root/spec/routing/cakes_routing_spec.rb
blob: d3c07c837ebbe3fe4a5d02bd9cbbca30bebee857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require "rails_helper"

describe "/cakes" do
  it "is the root of the website" do
    expect(get: '/').to route_to("cakes#index")
  end

  it "recognizes and generates #index" do
    expect(get: 'cakes').to route_to(controller: 'cakes', action: 'index')
  end

  it "recognizes and generates #show" do
    expect(get: "/cakes/1").to route_to(controller: "cakes", action: "show", id: "1")
  end

  it "routes to the newest cakes" do
    expect(get: '/cakes/newest').to route_to(controller: "cakes", action: "index", sort: 'newest')
  end

  it "routes to the oldest cakes" do
    expect(get: '/cakes/oldest').to route_to(controller: "cakes", action: "index", sort: 'oldest')
  end
end