Skip to content

Instantly share code, notes, and snippets.

@MarkMenard
Created December 14, 2010 17:52
Show Gist options
  • Save MarkMenard/740783 to your computer and use it in GitHub Desktop.
Save MarkMenard/740783 to your computer and use it in GitHub Desktop.
# 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
@MarkMenard
Copy link
Author

Bundler.... Oh the rabbit hole that turned into on this project. We're running in a Java web application embedded inside a Struts 1 app. (This is the beginning of the migration away from Struts.) We tried Bundler and had no end of issues. I've forked Bundler to start messing around with it and see if I can figure it out. I'm also not to enthused with the Bundler war deployment story. (Therefore forking Bundler to spend some time on it.)

@MarkMenard
Copy link
Author

The other thing I thought about was aliasing the mocha #mock, #stub, etc. methods to mocha_mock# or some such convention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment