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

Avoid deprecated TestResponse#success? method #2014

Merged
merged 1 commit into from
Jul 20, 2018

Conversation

composerinteralia
Copy link
Contributor

Closes #2009

TestResponse#success? was deprecated with this commit. 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.

@JonRowe
Copy link
Member

JonRowe commented Jul 17, 2018

Great, we're just working on fixing our ci (#2013), and then I'd like this rebased off a working build to check it's all green and I'll merge it.

@benoittgt
Copy link
Member

benoittgt commented Jul 20, 2018

CI is now green. Do you think you can rebase a re-push? I can look at this, this afternoon.

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
Copy link
Contributor Author

composerinteralia commented Jul 20, 2018

Hm, I rebased but I am now seeing several failures with Gem::RuntimeRequirementNotMetError: rdoc requires Ruby version >= 2.2.2 Looks like somebody reran the builds and they passed.

@benoittgt benoittgt merged commit 2f25700 into rspec:master Jul 20, 2018
@benoittgt
Copy link
Member

Thanks a lot @composerinteralia

@composerinteralia composerinteralia deleted the deprecated-success branch July 20, 2018 16:59
koppen added a commit to substancelab/rails-boilerplate that referenced this pull request Aug 20, 2019
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>'
koppen added a commit to substancelab/rails-boilerplate that referenced this pull request Aug 20, 2019
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>'
koppen added a commit to substancelab/rails-boilerplate that referenced this pull request Aug 20, 2019
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>'
koppen added a commit to substancelab/rails-boilerplate that referenced this pull request Aug 20, 2019
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>'
koppen added a commit to substancelab/rails-boilerplate that referenced this pull request Aug 21, 2019
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>'
koppen added a commit to substancelab/rails-boilerplate that referenced this pull request Aug 21, 2019
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>'
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

Successfully merging this pull request may close these issues.

3 participants