lib/wildcard_matchers/rspec.rb in wildcard_matchers-0.1.8 vs lib/wildcard_matchers/rspec.rb in wildcard_matchers-0.2.0
- old
+ new
@@ -9,11 +9,18 @@
match do |actual|
@matcher = WildcardMatchers::WildcardMatcher.new(expected)
@matcher === actual
end
- failure_message_for_should do |actual|
- @matcher.errors.join("\n")
+ # RSpec now prefers `failure_message` instead of `failure_message_for_should`.
+ if respond_to? :failure_message
+ failure_message do |actual| # RSpec 3.x
+ @matcher.errors.join("\n")
+ end
+ else
+ failure_message_for_should do |actual| # RSpec 1.2, 2.x
+ @matcher.errors.join("\n")
+ end
end
end
module RSpec::Matchers
alias wildcard_match_without_block wildcard_match