Skip to content

Instantly share code, notes, and snippets.

@alexch
Created April 27, 2011 20:08
Show Gist options
  • Save alexch/945067 to your computer and use it in GitHub Desktop.
Save alexch/945067 to your computer and use it in GitHub Desktop.
require "minitest/spec"
MiniTest::Unit.autorun
module DescribeBug
class Foo
def ==(other)
other.is_a? Foo
end
end
end
module DescribeBug
describe Foo do
before do
@foo = Foo.new
end
# this describe block gets blown away...
describe '#==' do
it 'is equal to itself' do
assert @foo == @foo
end
end
# ...by this one
describe "#<=>" do
it "compares equally to itself" do
assert (@foo <=> @foo) == 0
end
end
end
end
@phiggins
Copy link

phiggins commented Jun 8, 2011

This bug exists in the version of minitest in ruby's stdlib, but not in recent versions of the gem:

$ ruby describe_bug.rb 
"1.6.0"
Loaded suite describe_bug
Started
.
Finished in 0.000619 seconds.

1 tests, 1 assertions, 0 failures, 0 errors, 0 skips

Test run options: --seed 18185

$ ruby -I. -e "gem 'minitest' ; require 'describe_bug' "
"2.1.0"
Run options: --seed 40395

# Running tests:

..

Finished tests in 0.000965s, 2073.3553 tests/s, 2073.3553 assertions/s.

2 tests, 2 assertions, 0 failures, 0 errors, 0 skips

Instead of the weird command line I used, you can get the same effect by putting "gem 'minitest'" above any minitest requires.

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