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

RSpec Issue with RVM on Linux and OSX #1

Closed
wolfeidau opened this issue Nov 20, 2011 · 4 comments
Closed

RSpec Issue with RVM on Linux and OSX #1

wolfeidau opened this issue Nov 20, 2011 · 4 comments

Comments

@wolfeidau
Copy link

Having some issues using this gem with RVM.

As far as I can tell there is an issue with the file being located within the core rspec namespace. Intially I thought it was an RVM thing however I have run the test in a bare env with only the environment variables required for ruby and gem to work, this had the same issue.

Based on the messages we exchanged yesterday I understand why it is located in that namespace, however having hacked the project to move it to a empty namespace, similar to Fuubar formatter, I have made the gem work.

As I am quite a new to ruby I am not entirely sure my rather large changes are necessary. That said I have a feeling there were some other minor issues I flushed out while doing so. These are mainly related to requires statements and were uncovered when i added a spec to try out the changes.

I have checked in my updates to https://github.com/wolfeidau/rspec_junit_formatter if you could have a look at what I have done that would be great.

    $ rspec spec 
    /home/markw/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- j_unit_formatter (LoadError)
        from /home/markw/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:522:in `rescue in custom_formatter'
        from /home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:519:in `custom_formatter'
        from /home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:301:in `add_formatter'
        from /home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec-core-2.7.1/lib/rspec/core/configuration_options.rb:22:in `block in configure'
        from /home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec-core-2.7.1/lib/rspec/core/configuration_options.rb:22:in `each'
        from /home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec-core-2.7.1/lib/rspec/core/configuration_options.rb:22:in `configure'
        from /home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:17:in `run'
        from /home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in `run_in_process'
        from /home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:in `run'
        from /home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `block in autorun'
@wolfeidau
Copy link
Author

OK I did an strace while running rspec with the 0.1.1 version and rspec seems to be searching for the following.

    stat("/home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec_junit_formatter-0.1.1", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
    stat("/home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec_junit_formatter-0.1.1/lib/j_unit_formatter", 0x7fff41d4afa0) = -1 ENOENT (No such file or directory)
    stat("/home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec_junit_formatter-0.1.1/lib/j_unit_formatter.rb", 0x7fff41d4afa0) = -1 ENOENT (No such file or directory)
    stat("/home/markw/.rvm/gems/ruby-1.9.3-p0@rails31/gems/rspec_junit_formatter-0.1.1/lib/j_unit_formatter.so", 0x7fff41d4afa0) = -1 ENOENT (No such file or directory)

As you can see it cant locate the file so all bad.. The file that is present in this folder is named rspec_junit_formatter.rb

Rather than the configuration below, from the ReadMe

    --format JUnitFormatter
    --out rspec.xml

If i use the following it works!

    --format RspecJunitFormatter
    --out rspec.xml

@sj26
Copy link
Owner

sj26 commented Nov 21, 2011

We use rspec_junit_formatter on linux with rvm in our jenkins builds. I suspect you're not loading the gem before using the formatter.

Gems need to be required to be added to the load path by rubygems. In this case, you must require "rspec_junit_formatter" before using j_unit_formatter.

Try:

rspec -r rspec_junit_formatter -f j_unit_formatter spec

I'll update the README so this is a little more clear, I notice I've used --format RspecJunitFormatter and --format JUnitFormatter in there which is probably not helping!

@wolfeidau
Copy link
Author

Yeah being new to Ruby I think I took a very long path to the same destination, although I did learn a lot in the process.

I am planning to use it with Atlassian Bamboo CI server for pretty much the same reason.

/agree the issue I was having was mostly triggered by README

Thanks a lot for replying so promptly and sorry for hassling you so much :P

@sj26
Copy link
Owner

sj26 commented Nov 21, 2011

Not a problem! Thanks, the README has been updated in 1f1792c. :-)

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