spec/rspec/matchers/matcher_spec.rb in rspec-expectations-2.0.1 vs spec/rspec/matchers/matcher_spec.rb in rspec-expectations-2.1.0

- old
+ new

@@ -332,9 +332,17 @@ matcher.expecting('value').matches?('value').should be_true matcher.expecting('value').matches?('other value').should be_false end + it "prevents name collisions on chainable methods from different matchers" do + m1 = RSpec::Matchers::Matcher.new(:m1) { chain(:foo) { raise "foo in m1" } } + m2 = RSpec::Matchers::Matcher.new(:m2) { chain(:foo) { raise "foo in m2" } } + + expect { m1.foo }.to raise_error("foo in m1") + expect { m2.foo }.to raise_error("foo in m2") + end + context "defined using the dsl" do def a_method_in_the_example "method defined in the example" end