Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Implement and_wrap_original #762

Merged
merged 3 commits into from
Aug 24, 2014
Merged

Implement and_wrap_original #762

merged 3 commits into from
Aug 24, 2014

Conversation

JonRowe
Copy link
Member

@JonRowe JonRowe commented Aug 20, 2014

This probably needs more specs and needs features but this converts and_call_original into and_wrap_original then uses and_wrap_original to implement the old and_call_original (thus nicely proving it works!).

Closes #650.

@myronmarston
Copy link
Member

Thanks, @JonRowe, I plan to review this in the morning.

#
# @example
#
# expect(api).to receive(:large_list).and_wrap_original do |original_method|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good for this to show that the block receives the method args and a block (if there is one).

@myronmarston
Copy link
Member

The implementation looks great. I agree that it needs to have specs/cukes fleshed out more and it needs a changelog entry.

@JonRowe
Copy link
Member Author

JonRowe commented Aug 21, 2014

Ping, added some specs and a feature.

Feature: Wrapping the original implementation

Use `and_wrap_original` to make a partial double response as it normally would. This can
be useful when you want to expect a message without interfering with how it responds. You
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These sentences are confusing and inaccurate. It doesn't make it respond as it normally does...it makes it respond with whatever your block does (but your block has easy access to the original method). You use and_wrap_original (over and_call_original) specifically because you want to interfere with how it responds.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I knew I forgot to change something :P

@JonRowe JonRowe force-pushed the and_wrap_original branch 3 times, most recently from 51c4a05 to cb284c5 Compare August 23, 2014 14:43
@JonRowe JonRowe force-pushed the and_wrap_original branch from cb284c5 to a05ebbf Compare August 23, 2014 14:47
@JonRowe
Copy link
Member Author

JonRowe commented Aug 23, 2014

@myronmarston I addressed your feedback, waiting for travis though

@myronmarston
Copy link
Member

Needs a changelog, then merge away once green.

[skip ci]
JonRowe added a commit that referenced this pull request Aug 24, 2014
@JonRowe JonRowe merged commit fd9cd38 into master Aug 24, 2014
@JonRowe JonRowe deleted the and_wrap_original branch August 24, 2014 10:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature suggestion: and_wrap_original_with
2 participants