Class: Spec::Matchers::Include
- Defined in:
- lib/gems/rspec-1.1.12/lib/spec/matchers/include.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(*expecteds) ⇒ Include
constructor
A new instance of Include.
- #matches?(actual) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(*expecteds) ⇒ Include
Returns a new instance of Include.
6 7 8 |
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/include.rb', line 6 def initialize(*expecteds) @expecteds = expecteds end |
Instance Method Details
#description ⇒ Object
36 37 38 |
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/include.rb', line 36 def description "include #{_pretty_print(@expecteds)}" end |
#failure_message ⇒ Object
28 29 30 |
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/include.rb', line 28 def end |
#matches?(actual) ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/include.rb', line 10 def matches?(actual) @actual = actual @expecteds.each do |expected| if actual.is_a?(Hash) if expected.is_a?(Hash) expected.each_pair do |k,v| return false unless actual[k] == v end else return false unless actual.has_key?(expected) end else return false unless actual.include?(expected) end end true end |
#negative_failure_message ⇒ Object
32 33 34 |
# File 'lib/gems/rspec-1.1.12/lib/spec/matchers/include.rb', line 32 def ("not ") end |