Class | Spec::Matchers::SimpleMatcher |
In: |
vendor/plugins/rspec/lib/spec/matchers/simple_matcher.rb
|
Parent: | Object |
description | [W] | |
failure_message | [W] | |
negative_failure_message | [W] |
# File vendor/plugins/rspec/lib/spec/matchers/simple_matcher.rb, line 6 6: def initialize(description, &match_block) 7: @description = description 8: @match_block = match_block 9: end
# File vendor/plugins/rspec/lib/spec/matchers/simple_matcher.rb, line 21 21: def description 22: @description || explanation 23: end
# File vendor/plugins/rspec/lib/spec/matchers/simple_matcher.rb, line 33 33: def explanation 34: "No description provided. See RDoc for simple_matcher()" 35: end
# File vendor/plugins/rspec/lib/spec/matchers/simple_matcher.rb, line 25 25: def failure_message 26: @failure_message || (@description.nil? ? explanation : %[expected #{@description.inspect} but got #{@actual.inspect}]) 27: end
# File vendor/plugins/rspec/lib/spec/matchers/simple_matcher.rb, line 11 11: def matches?(actual) 12: @actual = actual 13: case @match_block.arity 14: when 2 15: @match_block.call(@actual, self) 16: else 17: @match_block.call(@actual) 18: end 19: end