Code Monkey home page Code Monkey logo

Comments (9)

dchelimsky avatar dchelimsky commented on June 19, 2024

This should only happen when RSpec::Mocks::setup is called explicitly.

from rspec-mocks.

wincent avatar wincent commented on June 19, 2024

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.

wincent avatar wincent commented on June 19, 2024

I'm wondering if something as simple as this will be close to what's need:

http://gist.github.com/462638

Breaks 4 examples, though, so currently looking into that.

from rspec-mocks.

dchelimsky avatar dchelimsky commented on June 19, 2024

I'm about to push the fix.

from rspec-mocks.

dchelimsky avatar dchelimsky commented on June 19, 2024

It's not quite that simple :)

from rspec-mocks.

dchelimsky avatar dchelimsky commented on June 19, 2024

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.

wincent avatar wincent commented on June 19, 2024

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.

dchelimsky avatar dchelimsky commented on June 19, 2024

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.

wincent avatar wincent commented on June 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.