Skip to content

Commit

Permalink
Don't use deprecated success? predicate
Browse files Browse the repository at this point in the history
See rspec/rspec-rails#2014 for details, fixes errors like

     Failure/Error: expect(response).to be_success
       expected #<ActionDispatch::TestResponse:0x0000560db29e9880 @mon_mutex=#<Thread::Mutex:0x0000560db29e9808>, @mo...ders:0x0000560db2cdf170 @Req=#<ActionController::TestRequest:0x0000560db29ea370 ...>>, @variant=[]>> to respond to `success?`
     # ./spec/controllers/people_controller_spec.rb:37:in `block (3 levels) in <main>'
     # ./spec/support/database_cleaner.rb:13:in `block (3 levels) in <main>'
     # ./spec/support/database_cleaner.rb:12:in `block (2 levels) in <main>'
  • Loading branch information
koppen committed Aug 21, 2019
1 parent 0e1205d commit b44c6e7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/templates/rspec/scaffold/controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
it "returns a success response" do
<%= class_name %>.create! valid_attributes
get :index, :params => {}, :session => valid_session
expect(response).to be_success
expect(response).to be_successful
end
end
Expand All @@ -32,14 +32,14 @@
get :show,
:params => {:id => <%= file_name %>.to_param},
:session => valid_session
expect(response).to be_success
expect(response).to be_successful
end
end
describe "GET #new" do
it "returns a success response" do
get :new, :params => {}, :session => valid_session
expect(response).to be_success
expect(response).to be_successful
end
end
Expand All @@ -49,7 +49,7 @@
get :edit,
:params => {:id => <%= file_name %>.to_param},
:session => valid_session
expect(response).to be_success
expect(response).to be_successful
end
end
Expand All @@ -76,7 +76,7 @@
post :create,
:params => {:<%= ns_file_name %> => invalid_attributes},
:session => valid_session
expect(response).to be_success
expect(response).to be_successful
end
end
end
Expand Down Expand Up @@ -120,7 +120,7 @@
:<%= ns_file_name %> => invalid_attributes
},
:session => valid_session
expect(response).to be_success
expect(response).to be_successful
end
end
end
Expand Down

0 comments on commit b44c6e7

Please sign in to comment.