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

Odd output for "Caused by" #2155

Closed
mockdeep opened this issue Jan 8, 2016 · 7 comments
Closed

Odd output for "Caused by" #2155

mockdeep opened this issue Jan 8, 2016 · 7 comments

Comments

@mockdeep
Copy link

mockdeep commented Jan 8, 2016

I'm seeing some confusing output when a spec fails after upgrading from 3.3 5o 3.4. For the most part everything is the same, but the new Caused by section says Errno::ECONNREFUSED. Is there some setting I'm missing?

Failures:

  1) Admin::AdminController#ensure_admin! when the user is an admin does nothing
     Failure/Error: expect(flash[:error]).not_to be_nil

       expected: not nil
            got: nil
     # ./spec/controllers/admin/admin_controller/ensure_admin_bang_spec.rb:22:in `block (3 levels) in <module:Admin>'
     # /home/fletch/.rvm/gems/ruby-2.1.7/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
     # /home/fletch/.rvm/gems/ruby-2.1.7/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `block in load'
     # /home/fletch/.rvm/gems/ruby-2.1.7/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
     # /home/fletch/.rvm/gems/ruby-2.1.7/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
     # /home/fletch/.rvm/gems/ruby-2.1.7/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call'
     # -e:1:in `<main>'
     # ------------------
     # --- Caused by: ---
     # Errno::ECONNREFUSED:
     #   Connection refused - connect(2) for "127.0.0.1" port 8989
     #   /home/fletch/.rvm/gems/ruby-2.1.7/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
@myronmarston
Copy link
Member

That is a bit odd. The Caused by: section was added in #2074. It uses Exception#cause (a new feature in Ruby 2.1). In your case, the Errno::ECONNREFUSED exception was somehow exposed as the cause from the RSpec expectation failure exception. I have no idea how that could occur -- off the top of my head, it seems likely to be a bug in Ruby.

Could you provide an executable example of the problem?

@JonRowe
Copy link
Member

JonRowe commented Jan 10, 2016

@mockdeep are you using selenium, poltergeist, or capybara-webkit or the like?

@mockdeep
Copy link
Author

@JonRowe Yeah, we're using capybara with selenium, though these are controller specs, which shouldn't be touched by capybara.

I tried it out in another application with the same rspec version and it works as expected, so I'll see if I can narrow down the issue. It's odd because I wouldn't expect a cause to be displayed at all here, since no error was raised...

@JonRowe
Copy link
Member

JonRowe commented Jan 10, 2016

Yes thats a sideeffect of how RSpec works, we use exceptions for test failures, and in this case the cause is displayed as it was present for some reason

@mockdeep
Copy link
Author

Okay, figured it out. We have --drb in the .rspec file of the project that is behaving strangely. Removing it made the Caused by go away, and when adding it to the other project I saw the same issue. After commenting out huge chunks of our spec_helper and Gemfile the error eventually reduced to this:

Failures:

  1) Admin::AdminController#ensure_admin! when the user is an admin does nothing
     Failure/Error: expect(flash[:error]).not_to be_nil

       expected: not nil
            got: nil
     # ./spec/controllers/admin/admin_controller/ensure_admin_bang_spec.rb:22:in `block (3 levels) in <module:Admin>'
     # ------------------
     # --- Caused by: ---
     # Errno::ECONNREFUSED:
     #   Connection refused - connect(2) for "127.0.0.1" port 8989
     #   /home/fletch/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/drb/drb.rb:839:in `initialize'

We're not using a drb server, so for now will just remove the configuration.

@myronmarston
Copy link
Member

Thanks for figuring out that the --drb flag was part of it!

I figured out the problem and fixed it in #2156.

@mockdeep
Copy link
Author

Great, thanks!

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

3 participants