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

Erroneous failure message : uninitialized constant Aruba::RSpec::Expectations #376

Closed
JESii opened this issue Apr 7, 2016 · 3 comments
Closed

Comments

@JESii
Copy link

JESii commented Apr 7, 2016

Summary

Attempting to use run_simple results in a mis-leading error message:
"uninitialized constant Aruba::RSpec::Expectations"

Expected Behavior

When the run_simple method is incorrect, then there should be a meaningful error message

Current Behavior

running the following spec:

  it('can do run_simple "false" without error') do
    result = run_simple("false")
    expect(result).to eql nil
  end

results in the error message/backtrace below

  1) basic plumbing working can do run_simple "false" without error
     Failure/Error: result = run_simple("false")

     NameError:
       uninitialized constant Aruba::RSpec::Expectations
     # /Users/yc98js1/.rvm/gems/ruby-2.0.0-p643/gems/aruba-0.14.1/lib/aruba/api/command.rb:283:in `rescue in run_simple'
     # /Users/yc98js1/.rvm/gems/ruby-2.0.0-p643/gems/aruba-0.14.1/lib/aruba/api/command.rb:280:in `run_simple'
     # ./spec/features/cuke_extract/cuke_extract_spec.rb:9:in `block (2 levels) in <top (required)>'

Possible Solution

Change line 283 of file /Users/yc98js1/dev/aruba/lib/aruba/api/command.rb to read as follows:
rescue ::RSpec::Expectations::ExpectationNotMetError => e
NOTE the addition of leading "namespace separator" (I don't know the proper term for the :: operator) to anchor the expression

Steps to Reproduce (for bugs)

I forked the repo, added a test for this bug but was unable to get rspec to run the tests successfully -- they all failed with
.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:inrequire': cannot load such file -- fuubar (LoadError)`

If you can help me get the tests running, I'll be happy to submit an update.

Context

Trying to use run_simple for the first time and this error led me astray.

Your Environment

  • Version used: 0.14.0
  • Operating System and version: Mac OSX 10.11 (El Capitan)
  • Link to your project: Private project
@ghost
Copy link

ghost commented Apr 8, 2016

Can you try to comment out the --format -line in .rspec in your local fork? see this for all places where we used it.

Can you also make sure, that you run rspec like this bundle exec rspec.

@JESii
Copy link
Author

JESii commented Apr 8, 2016

Thanks; that worked! Now all I have to do is figure out how to write my tests in RSpec, not Cucumber :=)

@maxmeyer
Copy link
Member

maxmeyer commented Apr 8, 2016

Now all I have to do is figure out how to write my tests in RSpec, not Cucumber :=)

What do you mean with this?

Anyway I added the "::" to make sure, you get the "right" error message.

@maxmeyer maxmeyer closed this as completed Apr 8, 2016
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