On Tue, Jul 21, 2020 at 11:16 PM 'Daniel Vandersluis' via rspec <
[email protected]> wrote:

> My test looked something like this:
>
> class MyObject
>   def call
>     do_something
>   end
>
> private
>
>   def do_something # this used to be public!
>     #...
>   end
> end
>
> subject { MyObject.new }
>
> expect(obj).to receive(:do_something)
> subject.call # this calls do_something
>
> Regardless of whether do_something is public or private, the expectation
> passes, but when called outside of a test, the method fails with
> NoMethodError because the method became private. I totally agree that the
> tests we had were not adequate, but also it wasn't something we were able
> to catch.
>


MyObject.new.call # => nil

Is it different on your end?

- Phil

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/CAAk5Ok9Wp%2BwUxvpHrXigmFA-LeDsLr2dZr0ud8Ye2K5VW3jBcA%40mail.gmail.com.

Reply via email to