Skip to content

Commit

Permalink
Merge pull request #18 from avh4/patch-2
Browse files Browse the repository at this point in the history
Update matchers.rb template for rspec 2
  • Loading branch information
drnic committed Jun 19, 2012
2 parents cf73d87 + d1e4053 commit 9ad4ca9
Showing 1 changed file with 11 additions and 9 deletions.
@@ -1,11 +1,13 @@
module Matchers
def contain(expected)
simple_matcher("contain #{expected.inspect}") do |given, matcher|
matcher.failure_message = "expected #{given.inspect} to contain #{expected.inspect}"
matcher.negative_failure_message = "expected #{given.inspect} not to contain #{expected.inspect}"
given.index expected
end
RSpec::Matchers.define :contain do |expected|
match do |actual|
actual.index expected
end

failure_message_for_should do |actual|
"expected #{actual.inspect} to contain #{expected.inspect}"
end
end

World(Matchers)
failure_message_for_should_not do |actual|
"expected #{actual.inspect} not to contain #{expected.inspect}"
end
end

0 comments on commit 9ad4ca9

Please sign in to comment.