rspec / rspec/rspec

[rspec-mocks] `and_call_original` doesn't properly verify arguments from initialize when stubbing new

Open
#119 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
117
Forks
51
Avg merge
59m
Merged PRs (30d)
3

Description

and_call_original doesn't properly verify arguments from initialize when stubbing new

From rspec/rspec-support#419:

We added support for new => initialize for verifying doubles, and_call_original never got support for it, we would need to support it there. You need to check that the method is the original implementation and not a custom def self.new which is very common, and a few other things, so I'd much rather have that logic in mocks atm.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading rspec/rspec-support#419 and tracing how rspec-mocks handles and_call_original when stubbing new. Determine how to verify initialize arguments only for the original implementation, while accounting for custom self.new methods. Done means the relevant argument verification works without applying to custom constructors.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.