Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mocked Objects do not pass block to process method #76

Closed
kenmazaika opened this Issue Apr 19, 2012 · 4 comments

Comments

Projects
None yet
3 participants
@kenmazaika
Copy link

kenmazaika commented Apr 19, 2012

Using the latest version of mocha (0.11.0) caused the test suite in capistrano to break on 1.8.7 and REE (1.9.3 worked fine).

The failure happened in: transfer_test.rb. The problem is that when the static method: Capistrano:Transfer.process is passed a block, when using the latest version of mocha the block was being sent through as nil, even though a block was provided. If this function is renamed to something else like:

def self.process_kittens_omg(direction, from, to, sessions, options={}, &block)

The block gets passed as expected.

I added a pull request to lock the version of mocha to the last version that worked: 0.10.5.

@ghost ghost assigned floehopper Apr 20, 2012

@floehopper

This comment has been minimized.

Copy link
Member

floehopper commented Apr 20, 2012

Thanks for reporting the issue. I am investigating.

@floehopper

This comment has been minimized.

Copy link
Member

floehopper commented Apr 21, 2012

This should be fixed in 379c9cd. Please let me know if not. The problem was that Capistrano::Transfer.process was being stubbed in two tests TransferTest and ConfigurationActionsFileTransferTest and in v0.11.0 of Mocha in Ruby 1.8.7, the original version of the stubbed method was not being restored correctly - the block parameter was being lost. The reason that the tests passed if you renamed the method in TransferTest was because this name was then different to the method stubbed in ConfigurationActionsFileTransferTest and so the two tests no longer interfered with each other. I hope that makes sense. Thanks for bringing the problem to my attention. Cheers, James.

@floehopper

This comment has been minimized.

Copy link
Member

floehopper commented Apr 21, 2012

Please note that I have released v0.11.1 including this fix and I have yanked v0.11.0.

@leehambley

This comment has been minimized.

Copy link

leehambley commented Apr 24, 2012

@floehopper Cheers, thanks for the fast turnaround... I'll wait for @kenmazaika to really confirm that it's fixed (we discovered this through a patch to cap, and Travis CI installed the latest mocha)

floehopper added a commit that referenced this issue Aug 6, 2012

Keep #95 fix for Ruby 1.9, but avoid regression in Ruby 1.8.
The clumsy code is needed to avoid a regression of #76 in Ruby 1.8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.