Module: RSpec::Matchers::Custom::MatchersHelper
- Defined in:
- lib/rspec-matchers-matchers/custom_matchers_helper.rb
Class Method Summary collapse
- .get_message(matcher, key) ⇒ Object
- .get_negative_failure_message(matcher) ⇒ Object
- .get_positive_failure_message(matcher) ⇒ Object
- .match_message(actual_message, expected_message) ⇒ Object
Class Method Details
.get_message(matcher, key) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rspec-matchers-matchers/custom_matchers_helper.rb', line 6 def self.(matcher, key) = matcher.instance_variable_get('@actual_messages') if .nil? = Hash.new matcher.instance_variable_set('@actual_messages',) end unless .has_key? key case key when :failure_message_for_should = matcher when :failure_message_for_should_not = matcher when :description = matcher.description else raise RuntimeError, "Unsupported key #{key}" end [key] = end [key] end |
.get_negative_failure_message(matcher) ⇒ Object
34 35 36 37 38 |
# File 'lib/rspec-matchers-matchers/custom_matchers_helper.rb', line 34 def self.(matcher) matcher.respond_to?(:failure_message_for_should_not) ? matcher. : matcher. end |
.get_positive_failure_message(matcher) ⇒ Object
28 29 30 31 32 |
# File 'lib/rspec-matchers-matchers/custom_matchers_helper.rb', line 28 def self.(matcher) matcher.respond_to?(:failure_message_for_should) ? matcher. : matcher. end |
.match_message(actual_message, expected_message) ⇒ Object
40 41 42 43 |
# File 'lib/rspec-matchers-matchers/custom_matchers_helper.rb', line 40 def self.(, ) # the method is simple, but we use it so we can stub it out if need be .eql? end |