rails/rails-controller-testing

Incompatibility in Rails 5.2 with RSpec 3.7?

pschambacher opened this issue · 6 comments

Hello! Just tried to upgrade one of my apps to Rails 5.2.0.beta 2 but all my specs are failing. Here's the trace:

Failure/Error:
  @_subscribers.each do |subscriber|
    ActiveSupport::Notifications.unsubscribe(subscriber)
  end

NoMethodError:
  undefined method `each' for nil:NilClass
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rails-controller-testing-1.0.2/lib/rails/controller/testing/template_assertions.rb:54:in `teardown_subscriptions'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-rails-3.7.2/lib/rspec/rails/adapters.rb:176:in `block (2 levels) in teardown'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:447:in `instance_exec'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:447:in `instance_exec'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:357:in `run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:509:in `block in run_owned_hooks_for'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:508:in `each'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:508:in `run_owned_hooks_for'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:595:in `block in run_example_hooks_for'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:594:in `each'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:594:in `run_example_hooks_for'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:465:in `run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:507:in `run_after_example'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:273:in `block in run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:500:in `block in with_around_and_singleton_context_hooks'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:457:in `block in with_around_example_hooks'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:466:in `block in run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:606:in `block in run_around_example_hooks_for'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:342:in `call'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-rails-3.7.2/lib/rspec/rails/example/controller_example_group.rb:191:in `block (2 levels) in <module:ControllerExampleGroup>'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:447:in `instance_exec'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:447:in `instance_exec'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:375:in `execute_with'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:608:in `block (2 levels) in run_around_example_hooks_for'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:342:in `call'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-rails-3.7.2/lib/rspec/rails/adapters.rb:127:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:447:in `instance_exec'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:447:in `instance_exec'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:375:in `execute_with'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:608:in `block (2 levels) in run_around_example_hooks_for'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:342:in `call'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:609:in `run_around_example_hooks_for'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/hooks.rb:466:in `run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:457:in `with_around_example_hooks'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:500:in `with_around_and_singleton_context_hooks'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example.rb:251:in `run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:628:in `block in run_examples'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:624:in `map'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:624:in `run_examples'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:590:in `run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:591:in `block in run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:591:in `map'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/example_group.rb:591:in `run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:118:in `block (3 levels) in run_specs'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:118:in `map'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:118:in `block (2 levels) in run_specs'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/configuration.rb:1896:in `with_suite_hooks'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:113:in `block in run_specs'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/reporter.rb:79:in `report'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:112:in `run_specs'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:87:in `run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:71:in `run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/lib/rspec/core/runner.rb:45:in `invoke'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rspec-core-3.7.0/exe/rspec:4:in `<top (required)>'
# ~/.rbenv/versions/2.4.2/bin/rspec:23:in `load'
# ~/.rbenv/versions/2.4.2/bin/rspec:23:in `<top (required)>'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/cli/exec.rb:75:in `load'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/cli/exec.rb:75:in `kernel_load'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/cli/exec.rb:28:in `run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/cli.rb:424:in `exec'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/cli.rb:27:in `dispatch'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/cli.rb:18:in `start'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/exe/bundle:30:in `block in <top (required)>'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/friendly_errors.rb:122:in `with_friendly_errors'
# ~/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/exe/bundle:22:in `<top (required)>'
# ~/.rbenv/versions/2.4.2/bin/bundle:23:in `load'
# ~/.rbenv/versions/2.4.2/bin/bundle:23:in `<main>'

There doesn't seem to be anything coming from my own stack in this trace. I forked this repo and ran the test with a 5.2 gemfile but everything is green. I'm not sure yet who's to blame between this gem and rspec?

It seems that setup_subscriptions was not called by RSpec. Maybe it is an RSpec issue?

I noticed there's an RSpec 3.8.0.pre... that's the version scheduled to be compatible with 5.2?

I have the same problem...

 112.3) Failure/Error: @@perform_request_original.bind(self).call *args, &block
              
              Faraday::TimeoutError:
                request timed out
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/adapters/faraday.rb:92:in `block in request'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/request/callbacks.rb:128:in `block in execute_callbacks'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/request/callbacks.rb:127:in `each'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/request/callbacks.rb:127:in `execute_callbacks'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/request/operations.rb:35:in `finish'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/easy_factory.rb:129:in `block in set_callback'
              # /usr/local/bundle/gems/ethon-0.10.1/lib/ethon/easy/response_callbacks.rb:68:in `block in complete'
              # /usr/local/bundle/gems/ethon-0.10.1/lib/ethon/easy/response_callbacks.rb:68:in `each'
              # /usr/local/bundle/gems/ethon-0.10.1/lib/ethon/easy/response_callbacks.rb:68:in `complete'
              # /usr/local/bundle/gems/ethon-0.10.1/lib/ethon/easy/operations.rb:33:in `perform'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/request/operations.rb:16:in `run'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/request/cacheable.rb:18:in `run'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/request/block_connection.rb:31:in `run'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/request/stubbable.rb:25:in `run'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/request/before.rb:26:in `run'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/adapters/faraday.rb:68:in `perform_request'
              # /usr/local/bundle/gems/typhoeus-0.8.0/lib/typhoeus/adapters/faraday.rb:58:in `call'
              # /usr/local/bundle/gems/faraday-0.15.2/lib/faraday/rack_builder.rb:143:in `build_response'
              # /usr/local/bundle/gems/faraday-0.15.2/lib/faraday/connection.rb:387:in `run_request'
              # /usr/local/bundle/gems/elasticsearch-transport-5.0.3/lib/elasticsearch/transport/transport/http/faraday.rb:23:in `block in perform_request'
              # /usr/local/bundle/gems/elasticsearch-transport-5.0.3/lib/elasticsearch/transport/transport/base.rb:261:in `perform_request'
              # ./lib/ext/elasticsearch/transport.rb:19:in `call'
              # ./lib/ext/elasticsearch/transport.rb:19:in `perform_request'
              # /usr/local/bundle/gems/elasticsearch-transport-5.0.3/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
              # /usr/local/bundle/gems/elasticsearch-transport-5.0.3/lib/elasticsearch/transport/client.rb:131:in `perform_request'
              # /usr/local/bundle/gems/elasticsearch-api-5.0.3/lib/elasticsearch/api/namespace/common.rb:21:in `perform_request'
              # /usr/local/bundle/gems/elasticsearch-api-5.0.3/lib/elasticsearch/api/actions/indices/delete.rb:44:in `delete'
              # ./spec/elasticsearch_spec_helper.rb:12:in `block (2 levels) in <top (required)>'

This issue has been automatically closed because there has been no follow-up response from the original author. We currently don't have enough information in order to take action. Please reach out if you have any additional information that will help us move this issue forward.

commenting in case someone stumbles onto this in the future. It's resolved by adding the flag type: :request
https://github.com/rswag/rswag/blob/master/test-app/spec/integration/blogs_spec.rb