diff options
| author | mo khan <mo@mokhan.ca> | 2014-10-18 19:16:37 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-10-18 19:16:37 -0600 |
| commit | 6a07f43e2f8b2ff287ee70bccf879219b5b09cd8 (patch) | |
| tree | 8895176ddc364cf35784f92830b369cadadd1d86 /spec/routing | |
| parent | d11af17e3cbc3622fae5f7cec5c31a2f44ebdf41 (diff) | |
route categories to the cakes controller and remove old categories controller.
Diffstat (limited to 'spec/routing')
| -rw-r--r-- | spec/routing/cakes_routing_spec.rb | 32 | ||||
| -rw-r--r-- | spec/routing/categories_routing_spec.rb | 13 |
2 files changed, 22 insertions, 23 deletions
diff --git a/spec/routing/cakes_routing_spec.rb b/spec/routing/cakes_routing_spec.rb index bcb34e00..d3c07c83 100644 --- a/spec/routing/cakes_routing_spec.rb +++ b/spec/routing/cakes_routing_spec.rb @@ -1,25 +1,23 @@ require "rails_helper" -describe CakesController do - describe "routing" do - it "is the root of the website" do - expect(get: '/').to route_to("cakes#index") - end +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 #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 "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 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 + it "routes to the oldest cakes" do + expect(get: '/cakes/oldest').to route_to(controller: "cakes", action: "index", sort: 'oldest') end end diff --git a/spec/routing/categories_routing_spec.rb b/spec/routing/categories_routing_spec.rb index e7382f17..97920736 100644 --- a/spec/routing/categories_routing_spec.rb +++ b/spec/routing/categories_routing_spec.rb @@ -1,10 +1,11 @@ require "rails_helper" -describe CategoriesController do - describe "routing" do - it "routes to #show" do - expect(get: "/categories/fondant").to route_to(id: "fondant", controller: "categories", action: "show") - end +describe '/categories' do + it "routes to #show" do + expect(get: "/categories/fondant").to route_to(category: "fondant", controller: "cakes", action: "index") end -end + it '/categories/cookies/page/2' do + expect(get: "/categories/fondant/page/2").to route_to(category: "fondant", controller: "cakes", action: "index", page: '2') + end +end |
