Skip to content
Browse files

Merge pull request #18 from avh4/patch-2

Update matchers.rb template for rspec 2
  • Loading branch information...
2 parents cf73d87 + d1e4053 commit 9ad4ca905de2355ada919cce0ef687f2c441575f @drnic committed Jun 19, 2012
Showing with 11 additions and 9 deletions.
  1. +11 −9 rubygems_generators/install_cucumber/templates/features/support/matchers.rb
View
20 rubygems_generators/install_cucumber/templates/features/support/matchers.rb
@@ -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.
Something went wrong with that request. Please try again.