psyho / bogus

Fake library for Ruby
Other
359 stars 14 forks source link

RSpec methods not overriden #1

Closed RKushnir closed 11 years ago

RKushnir commented 11 years ago

When trying to stub a method on an object like so:

stub(object).bar { 42 }

the RSpec's own stub method is being called, not the Bogus'. I guess, when I require bogus/rspec in spec_helper it includes the Bogus::MockingDSL, but the RSpec itself is lower in the ancestor chain, so it overrides the methods with coinciding names.

The Bogus.create_stub call works just fine.

psyho commented 11 years ago

What version of Bogus are you using? If it's 0.0.2, could you try with the latest: 0.0.3?

If you are already using it, does it help if you set the mock framework:

RSpec.configure do |config|
  config.mock_with Bogus::RSpecAdapter
end

If that does not help, it would help me a lot if you pasted the versions of bundler/rspec you are using and the require order in your spec_helper.rb file, because I did not manage to reproduce this bug locally.

RKushnir commented 11 years ago

@psyho I was using 0.0.2. After update to 0.0.3 it works. Thanks.

RKushnir commented 11 years ago

Btw, sorry for spoiling your untouched issue list :) Thank you for this cool library.

psyho commented 11 years ago

It's entirely my fault for using rc versions for a gem that did not hit 0.1.0 yet;) Let me know if you encounter any more problems.