Class: Merb::Test::Rspec::ViewMatchers::NotMatchTag
- Defined in:
- lib/merb-core/test/matchers/view_matchers.rb
Instance Method Summary collapse
-
#failure_message ⇒ Object
Returns String:: The failure message.
-
#initialize(attrs) ⇒ NotMatchTag
constructor
Parameters attrs<Hash>:: A set of attributes that must not be matched.
-
#matches?(target) ⇒ Boolean
Parameters target<String>:: The target to look for the match in.
Constructor Details
#initialize(attrs) ⇒ NotMatchTag
Parameters
- attrs<Hash>
-
A set of attributes that must not be matched.
93 94 95 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 93 def initialize(attrs) @attrs = attrs end |
Instance Method Details
#failure_message ⇒ Object
Returns
- String
-
The failure message.
114 115 116 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 114 def @errors[0] end |
#matches?(target) ⇒ Boolean
Parameters
- target<String>
-
The target to look for the match in.
Returns
- Boolean
-
True if none of the attributes were matched.
102 103 104 105 106 107 108 109 110 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 102 def matches?(target) @errors = [] @attrs.each do |attr, val| if target.include?("#{attr}=\"#{val}\"") @errors << "Should not include #{attr}=\"#{val}\", but was #{target}" end end @errors.size == 0 end |