Skip to content

Commit

Permalink
Avoid deprecated TestResponse#success? method
Browse files Browse the repository at this point in the history
Closes rspec#2009

The #successful? method has been available for a long time. Just to
be safe I tried this with Rails 3.2, 4.2, and 5.2 and everything seemed
to work fine with this change.
  • Loading branch information
composerinteralia committed Jul 15, 2018
1 parent e3cad68 commit 4eab808
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<% else -%>
get :index, params: {}, session: valid_session
<% end -%>
expect(response).to be_success
expect(response).to be_successful
end
end
Expand All @@ -64,7 +64,7 @@
<% else -%>
get :show, params: {id: <%= file_name %>.to_param}, session: valid_session
<% end -%>
expect(response).to be_success
expect(response).to be_successful
end
end
Expand Down
12 changes: 6 additions & 6 deletions lib/generators/rspec/scaffold/templates/controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<% else -%>
get :index, params: {}, session: valid_session
<% end -%>
expect(response).to be_success
expect(response).to be_successful
end
end
Expand All @@ -64,7 +64,7 @@
<% else -%>
get :show, params: {id: <%= file_name %>.to_param}, session: valid_session
<% end -%>
expect(response).to be_success
expect(response).to be_successful
end
end
Expand All @@ -75,7 +75,7 @@
<% else -%>
get :new, params: {}, session: valid_session
<% end -%>
expect(response).to be_success
expect(response).to be_successful
end
end
Expand All @@ -87,7 +87,7 @@
<% else -%>
get :edit, params: {id: <%= file_name %>.to_param}, session: valid_session
<% end -%>
expect(response).to be_success
expect(response).to be_successful
end
end
Expand Down Expand Up @@ -120,7 +120,7 @@
<% else -%>
post :create, params: {<%= ns_file_name %>: invalid_attributes}, session: valid_session
<% end -%>
expect(response).to be_success
expect(response).to be_successful
end
end
end
Expand Down Expand Up @@ -161,7 +161,7 @@
<% else -%>
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, session: valid_session
<% end -%>
expect(response).to be_success
expect(response).to be_successful
end
end
end
Expand Down

0 comments on commit 4eab808

Please sign in to comment.