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

Unable to require statsd/instrument if rspec already required #77

Closed
inglesp opened this issue Mar 16, 2016 · 1 comment
Closed

Unable to require statsd/instrument if rspec already required #77

inglesp opened this issue Mar 16, 2016 · 1 comment

Comments

@inglesp
Copy link

inglesp commented Mar 16, 2016

If a project is using rspec 2, you cannot require statsd/instrument if you've already required rspec:

$ bundle exec irb
irb(main):001:0> require "rspec"
=> true
irb(main):002:0> require "statsd/instrument"
NameError: uninitialized constant RSpec::Matchers::Composable
    from /Users/peteringlesby/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/statsd-instrument-2.0.11/lib/statsd/instrument/matchers.rb:14:in `<class:Matcher>'
    from /Users/peteringlesby/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/statsd-instrument-2.0.11/lib/statsd/instrument/matchers.rb:13:in `<module:Matchers>'
    from /Users/peteringlesby/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/statsd-instrument-2.0.11/lib/statsd/instrument/matchers.rb:3:in `<top (required)>'
    from /Users/peteringlesby/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/statsd-instrument-2.0.11/lib/statsd/instrument.rb:382:in `require'
    from /Users/peteringlesby/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/statsd-instrument-2.0.11/lib/statsd/instrument.rb:382:in `<top (required)>'
    from (irb):2:in `require'
    from (irb):2
    from /Users/peteringlesby/.rbenv/versions/2.0.0-p353/bin/irb:12:in `<main>'

Requiring statsd/instrument by itself works fine:

$ bundle exec irb
irb(main):001:0> require "statsd/instrument"
=> true

There are no problems with rspec 3.

I've tested with rspec 2.11.1, and rspec 3.4.4, with the most recent version of stats-instrument.

@wvanbergen
Copy link
Contributor

The problem most likely is https://github.com/Shopify/statsd-instrument/blob/master/lib/statsd/instrument.rb#L382

We're not using rspec ourselves; it was contributed to this library by someone else. If you can find a fix that will make it work with RSpec 2 as well, I am happy to merge it.

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