Late to the party but your example is incomplete, how is post defined?

Jon Rowe
---------------------------
[email protected]
jonrowe.co.uk

On 22 July 2020 at 01:55, 'Daniel Vandersluis' via rspec wrote:
> Sorry my example was slightly off (pains of trying to anonymize!), because 
> it's actually calling a (now) private method of a different class. Oops!
>
> Here's a better sample:
>
> class Post
> private
>
> def process # used to be public
> # ...
> end
> end
>
> class Operation
> def self.call (http://self.call)
> post.process
> # do other things here
> end
> end
>
> RSpec.describe Operation do
> subject { described_class }
>
> it do
> expect(post).to receive(:process)
> subject.call (http://subject.call)
> end
> end
>
> Now the test still succeeds but the code doesn't. I understand your 
> suggestion of testing to make sure that methods are the expected 
> accessibility, but this is probably too cumbersome in practice in a large 
> codebase.

-- 
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/dejalu-217-b2d13b53-feb2-4a98-ad5a-ce1f4fe56d56%40jonrowe.co.uk.

Reply via email to