Commit 6fe1f78b8da29aa1e04c17b2833b576b727e613f
1 parent
f34f70e0
Exists in
colab
and in
4 other branches
All the routing specs are using the shoulda-matchers syntax
Showing
2 changed files
with
16 additions
and
24 deletions
Show diff stats
spec/routing/home_routing_spec.rb
| ... | ... | @@ -2,8 +2,7 @@ require "spec_helper" |
| 2 | 2 | |
| 3 | 3 | describe HomeController do |
| 4 | 4 | describe "routing" do |
| 5 | - it 'should route to #index' do | |
| 6 | - get('/').should route_to('home#index') | |
| 7 | - end | |
| 5 | + it { should route(:get, '/'). | |
| 6 | + to(controller: :home, action: :index) } | |
| 8 | 7 | end |
| 9 | 8 | end |
| 10 | 9 | \ No newline at end of file | ... | ... |
spec/routing/project_routing_spec.rb
| ... | ... | @@ -2,32 +2,25 @@ require "spec_helper" |
| 2 | 2 | |
| 3 | 3 | describe ProjectsController do |
| 4 | 4 | describe "routing" do |
| 5 | - it 'should route to #new' do | |
| 6 | - get('/projects/new').should route_to('projects#new') | |
| 7 | - end | |
| 5 | + it { should route(:get, '/projects/new'). | |
| 6 | + to(controller: :projects, action: :new) } | |
| 8 | 7 | |
| 9 | - it 'should route to #index' do | |
| 10 | - get('/projects').should route_to('projects#index') | |
| 11 | - end | |
| 8 | + it { should route(:get, '/projects'). | |
| 9 | + to(controller: :projects, action: :index) } | |
| 12 | 10 | |
| 13 | - it 'should route to #create' do | |
| 14 | - post('/projects').should route_to('projects#create') | |
| 15 | - end | |
| 11 | + it { should route(:post, '/projects'). | |
| 12 | + to(controller: :projects, action: :create) } | |
| 16 | 13 | |
| 17 | - it 'should route to #show' do | |
| 18 | - get('/projects/1').should route_to('projects#show', :id => "1") | |
| 19 | - end | |
| 14 | + it { should route(:get, '/projects/1'). | |
| 15 | + to(controller: :projects, action: :show, id: "1") } | |
| 20 | 16 | |
| 21 | - it 'should route to #edit' do | |
| 22 | - get('/projects/1/edit').should route_to('projects#edit', :id => "1") | |
| 23 | - end | |
| 17 | + it { should route(:get, '/projects/1/edit'). | |
| 18 | + to(controller: :projects, action: :edit, id: "1") } | |
| 24 | 19 | |
| 25 | - it 'should route to #update' do | |
| 26 | - put('/projects/1').should route_to('projects#update', :id => "1") | |
| 27 | - end | |
| 20 | + it { should route(:put, '/projects/1'). | |
| 21 | + to(controller: :projects, action: :update, id: "1") } | |
| 28 | 22 | |
| 29 | - it 'should route to #destroy' do | |
| 30 | - delete('/projects/1').should route_to('projects#destroy', :id => "1") | |
| 31 | - end | |
| 23 | + it { should route(:delete, '/projects/1'). | |
| 24 | + to(controller: :projects, action: :destroy, id: "1") } | |
| 32 | 25 | end |
| 33 | 26 | end |
| 34 | 27 | \ No newline at end of file | ... | ... |