Commit 5bfaacd5
Changed files (4)
config
spec
services
handlers
config/routes.rb
@@ -13,12 +13,15 @@ Cake::Application.routes.draw do
get ':id/page/:page', :action => :show, :on => :collection
end
- resources :creations, only: [:index, :show] do
+ resources :creations, only: [:index, :show], path: 'cakes' do
resources :photos, only: [:index, :show]
resources :favorites, :only => [:index, :create]
get 'page/:page', :action => :index, :on => :collection, as: :paginate
end
+ get '/creations' => redirect('/cakes')
+ get 'creations/:id', to: redirect('/cakes/%{id}')
+
resources :profiles, :only => [:index, :show] do
get 'page/:page', :action => :index, :on => :collection, as: :paginate
end
spec/routing/creations_routing_spec.rb
@@ -3,15 +3,15 @@ require "rails_helper"
describe CreationsController do
describe "routing" do
it "is the root of the website" do
- { get: '/' }.should route_to("creations#index")
+ expect(get: '/').to route_to("creations#index")
end
it "recognizes and generates #index" do
- { :get => "/creations" }.should route_to(:controller => "creations", :action => "index")
+ expect(get: 'cakes').to route_to(controller: 'creations', action: 'index')
end
it "recognizes and generates #show" do
- { :get => "/creations/1" }.should route_to(:controller => "creations", :action => "show", :id => "1")
+ expect(get: "/cakes/1").to route_to(controller: "creations", action: "show", id: "1")
end
end
end
spec/routing/favorites_routing_spec.rb
@@ -2,9 +2,8 @@ require "rails_helper"
describe FavoritesController do
describe "routing" do
-
it "routes to #index" do
- { get: "/creations/1/favorites" }.should route_to({
+ { get: "/cakes/1/favorites" }.should route_to({
:controller => "favorites",
:action => "index",
:creation_id => "1"
@@ -12,7 +11,7 @@ describe FavoritesController do
end
it "routes to #create" do
- { post: "/creations/1/favorites" }.should route_to({
+ { post: "/cakes/1/favorites" }.should route_to({
:controller => "favorites",
:action => "create",
:creation_id => "1"
spec/services/handlers/publish_cake_to_twitter_spec.rb
@@ -29,7 +29,7 @@ describe PublishCakeToTwitter do
it "tweets new cakes" do
subject.handle(cake_id: id)
- twitter.should have_received(:tweet).with("yummy By joe on http://www.blah.com/creations/88-yummy!")
+ twitter.should have_received(:tweet).with("yummy By joe on http://www.blah.com/cakes/88-yummy!")
end
end