Created
December 14, 2010 17:52
-
-
Save MarkMenard/740783 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # My first attempt at using both Mocha and RSpec mocks in a project. | |
| module Spec | |
| module Adapters | |
| module MockFramework | |
| # Mocha::Standalone was deprecated as of Mocha 0.9.7. | |
| begin | |
| include Mocha::API | |
| rescue NameError | |
| include Mocha::Standalone | |
| end | |
| include Spec::Mocks::ExampleMethods | |
| def setup_mocks_for_rspec | |
| mocha_setup | |
| $rspec_mocks ||= Spec::Mocks::Space.new | |
| end | |
| def verify_mocks_for_rspec | |
| mocha_verify | |
| $rspec_mocks.verify_all | |
| end | |
| def teardown_mocks_for_rspec | |
| mocha_teardown | |
| $rspec_mocks.reset_all | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The other thing I thought about was aliasing the mocha #mock, #stub, etc. methods to mocha_mock# or some such convention.