Class: Spec::Expectations::Should::Base
- Defined in:
- lib/spec/expectations/should/base.rb
Instance Method Summary collapse
-
#==(expected) ⇒ Object
and =~ will stay after the new syntax.
- #=~(expected) ⇒ Object
- #default_message(expectation, expected = nil) ⇒ Object
- #fail_with_message(message, expected = nil, target = nil) ⇒ Object
- #find_supported_sym(original_sym) ⇒ Object
Instance Method Details
#==(expected) ⇒ Object
and =~ will stay after the new syntax
7 8 9 |
# File 'lib/spec/expectations/should/base.rb', line 7 def ==(expected) __delegate_method_missing_to_target "==", "==", expected end |
#=~(expected) ⇒ Object
11 12 13 |
# File 'lib/spec/expectations/should/base.rb', line 11 def =~(expected) __delegate_method_missing_to_target "=~", "=~", expected end |
#default_message(expectation, expected = nil) ⇒ Object
35 36 37 38 |
# File 'lib/spec/expectations/should/base.rb', line 35 def (expectation, expected=nil) return "expected #{expected.inspect}, got #{@target.inspect} (using #{expectation})" if expectation == '==' "expected #{expectation} #{expected.inspect}, got #{@target.inspect}" unless expectation == '==' end |
#fail_with_message(message, expected = nil, target = nil) ⇒ Object
40 41 42 |
# File 'lib/spec/expectations/should/base.rb', line 40 def (, expected=nil, target=nil) Spec::Expectations.fail_with(, expected, target) end |
#find_supported_sym(original_sym) ⇒ Object
44 45 46 47 48 |
# File 'lib/spec/expectations/should/base.rb', line 44 def find_supported_sym(original_sym) ["#{original_sym}?", "#{original_sym}s?"].each do |alternate_sym| return alternate_sym.to_s if @target.respond_to?(alternate_sym.to_s) end end |