Skip to content

Instantly share code, notes, and snippets.

@floehopper
Created April 28, 2011 16:14
Show Gist options
  • Save floehopper/946668 to your computer and use it in GitHub Desktop.
Save floehopper/946668 to your computer and use it in GitHub Desktop.
Attempt to reproduce problem mentioned by Marc Love in Mocha Issue #18
$ ruby -v # => ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02
$ rails -v # => Rails 3.0.7
$ cd /tmp
$ rails new mocha-issue-18
$ cd mocha-issue-18
$ cat <<EOF >>Gemfile
group :test do
gem 'mocha', :require => false
end
EOF
$ bundle install --path .bundle/gems
$ bundle list mocha # => /private/tmp/mocha-issue-18/.bundle/gems/ruby/1.8/gems/mocha-0.9.12
$ rake db:create:all
$ script/rails generate model user name:string
$ rake db:migrate
$ cat <<EOF >test/unit/user_test.rb
require 'test_helper'
class UserTest < ActiveSupport::TestCase
setup do
User.expects(:new).once
end
test "once" do
User.new
end
test "twice" do
User.new
end
end
EOF
$ MOCHA_OPTIONS=debug rake
(in /private/tmp/mocha-issue-18)
Detected Ruby version: 1.8.7
Detected Test::Unit version: 1.x
Monkey patching Test::Unit for Ruby >= v1.8.6
Loaded suite /private/tmp/mocha-issue-18/.bundle/gems/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
..
Finished in 0.01379 seconds.
2 tests, 2 assertions, 0 failures, 0 errors
@floehopper
Copy link
Author

See this comment for details.

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