Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffold controller spec template uses deprecated 'success?` method #2009

Closed
composerinteralia opened this issue Jul 13, 2018 · 1 comment
Closed

Comments

@composerinteralia
Copy link
Contributor

When creating a resource with rails generate scaffold, we use this template for the rspec controller specs:
https://github.com/rspec/rspec-rails/blob/master/lib/generators/rspec/scaffold/templates/controller_spec.rb#L67

But the success? method on the response was deprecated:
https://github.com/rails/rails/blob/20c91119903f70eb19aed33fe78417789dbf070f/actionpack/lib/action_dispatch/testing/test_response.rb#L23

This may be as simple as changing the controller spec template to use be_successful instead of be_success. I can make a PR for this next week if nobody else does.

You can see the deprecation warning by running the specs here: https://github.com/composerinteralia/rspec-deprecated-method-app

Ruby version: 2.5.1
Rails version: 5.2.0
Rspec version: 3.7

@benoittgt
Copy link
Member

Hello @composerinteralia

Thanks for the comment. Feel free to open a PR to address this warning.

🎉

composerinteralia added a commit to composerinteralia/rspec-rails that referenced this issue Jul 15, 2018
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.
composerinteralia added a commit to composerinteralia/rspec-rails that referenced this issue Jul 15, 2018
Closes rspec#2009

TestResponse#success? was deprecated with [this
commit](rails/rails@af3500b).
Instead, we can use #successful? from Rack::Response::Helpers. This
method has been available for a long time. I tried this change with
Rails 3.2, 4.2, and 5.2 and everything seemed to work fine.
composerinteralia added a commit to composerinteralia/rspec-rails that referenced this issue Jul 20, 2018
Closes rspec#2009

TestResponse#success? was deprecated with [this
commit](rails/rails@af3500b).
Instead, we can use #successful? from Rack::Response::Helpers. This
method has been available for a long time. I tried this change with
Rails 3.2, 4.2, and 5.2 and everything seemed to work fine.
sebjacobs pushed a commit to futurelearn/rspec-rails that referenced this issue Mar 15, 2019
Closes rspec#2009

TestResponse#success? was deprecated with [this
commit](rails/rails@af3500b).
Instead, we can use #successful? from Rack::Response::Helpers. This
method has been available for a long time. I tried this change with
Rails 3.2, 4.2, and 5.2 and everything seemed to work fine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants