Class: Spec::Matchers::Include
- Defined in:
- lib/gems/rspec-1.1.11/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?(given) ⇒ 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.11/lib/spec/matchers/include.rb', line 6 def initialize(*expecteds) @expecteds = expecteds end |
Instance Method Details
#description ⇒ Object
33 34 35 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/include.rb', line 33 def description "include #{_pretty_print(@expecteds)}" end |
#failure_message ⇒ Object
25 26 27 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/include.rb', line 25 def end |
#matches?(given) ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/include.rb', line 10 def matches?(given) @given = given @expecteds.each do |expected| case given when Hash expected.each_pair do |k,v| return false unless given[k] == v end else return false unless given.include?(expected) end end true end |
#negative_failure_message ⇒ Object
29 30 31 |
# File 'lib/gems/rspec-1.1.11/lib/spec/matchers/include.rb', line 29 def ("not ") end |