Skip to content

Instantly share code, notes, and snippets.

@floehopper
Created February 10, 2012 13:12
Show Gist options
  • Save floehopper/1789600 to your computer and use it in GitHub Desktop.
Save floehopper/1789600 to your computer and use it in GitHub Desktop.
Mocha teardown hook not being fired by Rspec?
require "bundler/setup"
RSpec.configure do |config|
config.mock_framework = :mocha
end
class Foo
def self.bar; end
end
describe Foo do
it "bar 1" do
Foo.expects(:bar)
Foo.bar
end
it "bar 2" do
Foo.bar
end
end
source :rubygems
gem 'rspec', '2.8.0'
gem 'mocha', '0.10.4'
@floehopper
Copy link
Author

$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.0.1]

$ bundle list
Gems included by the bundle:
  * bundler (1.0.21)
  * diff-lcs (1.1.3)
  * metaclass (0.0.1)
  * mocha (0.10.4)
  * rspec (2.8.0)
  * rspec-core (2.8.0)
  * rspec-expectations (2.8.0)
  * rspec-mocks (2.8.0)

$ rspec foo_spec.rb
..

Finished in 0.00063 seconds
2 examples, 0 failures

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