Comments (9)
This should only happen when RSpec::Mocks::setup
is called explicitly.
from rspec-mocks.
Looking at the code now, looks like you've done a great job of compartmentalizing the "extensions to the Object namespace" and all the rest, so hopefully this won't be too painful to implement.
from rspec-mocks.
I'm wondering if something as simple as this will be close to what's need:
Breaks 4 examples, though, so currently looking into that.
from rspec-mocks.
I'm about to push the fix.
from rspec-mocks.
It's not quite that simple :)
from rspec-mocks.
require 'rspec/mocks' does not add methods to Object or ExampleGroup
- call RSpec::Mocks::setup(self) from an example to add double(),
mock(), and stub() methods to self, and should_receive(),
should_not_receive(), and stub() methods to Object. - NOTE the stub() on self is an alias for double(), whereas the stub()
on every other object is a method stub declaration.
Closed by e8b3fde.
from rspec-mocks.
Er, if you say so ;-)
Funnily enough, I found that my "simple" solution actually does pass all specs if I remove the config.include(RSpec::Mocks::Methods)
from the spec_helper.
Nice work anyway.
Cheers,
Wincent
from rspec-mocks.
There was another step to this, which is that I wanted to simplify the API for the consuming framework. With the changes I made, rspec-core doesn't need to include RSpec::Mocks::ExampleMethods
.
FWIW, I wasn't clear that you were working on a solution until I your comment with the gist above, at which point I was pretty much done with the work I was doing. I appreciate your efforts to contribute and don't want to waste your time when doing so, so I apologize for not making it more clear that this was in progress on my end.
Cheers,
David
from rspec-mocks.
Don't worry about it, it's not like it took me long to do my 2-line patch + feature. The only thing that matters is that the project moves forward, one way or another.
Cheers,
Wincent
from rspec-mocks.
Related Issues (20)
- Expecting kwargs does not work in Ruby 3.2. HOT 15
- and_wrap_original doesn't work with kwargs in Ruby 3.2 HOT 3
- array_excluding matcher? HOT 2
- Rails 7.1 breaks receive().with HOT 6
- Assertion that Array#reverse is not called always fails
- stub_const doesn't work with constant inside `class << self` block HOT 3
- update repository 'About' setting to use rspec.info docs url instead of Relish
- Mocking methods changes `Method#parameters`. HOT 1
- Keyword args not validated HOT 1
- RSpec 3.11 mistakes kwargs for hash, when `verify_partial_doubles` is set to true HOT 4
- stub_const does not restore Object.const_source_location after reset HOT 3
- doc: broken links (404) on rspec.info HOT 6
- hash_including deviates from a_hash_including HOT 1
- (Fixed in `3.13.0pre`) `ActiveSupport`'s `Object#with` core extension overrides `RSpec::Mocks::Matchers::Receive(Object)#with` HOT 1
- facing issue with rspec-mocks test cases HOT 1
- `stack level too deep` when stubbing :is_a? with allow_any_instance_of
- `stack level too deep` when stubbing :is_a? with allow_any_instance_of
- `stub_const` doesn't clear `Class#subclasses` HOT 15
- and_wrap_original failing in ruby 3.2
- Mutex cannot be mocked since 3.9.0 (Stack level too deep) HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspec-mocks.