Class: Merb::Test::Rspec::ViewMatchers::HasContent
- Defined in:
- lib/merb-core/test/matchers/view_matchers.rb
Instance Method Summary collapse
- #content_message ⇒ Object
-
#failure_message ⇒ Object
Returns String:: The failure message.
-
#initialize(content) ⇒ HasContent
constructor
A new instance of HasContent.
- #matches?(element) ⇒ Boolean
-
#negative_failure_message ⇒ Object
Returns String:: The failure message to be displayed in negative matches.
Constructor Details
#initialize(content) ⇒ HasContent
Returns a new instance of HasContent.
287 288 289 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 287 def initialize(content) @content = content end |
Instance Method Details
#content_message ⇒ Object
314 315 316 317 318 319 320 321 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 314 def case @content when String "include \"#{@content}\"" when Regexp "match #{@content.inspect}" end end |
#failure_message ⇒ Object
Returns
- String
-
The failure message.
304 305 306 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 304 def "expected the following element's content to #{}:\n#{@element.inner_text}" end |
#matches?(element) ⇒ Boolean
291 292 293 294 295 296 297 298 299 300 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 291 def matches?(element) @element = element case @content when String @element.contains?(@content) when Regexp @element.matches?(@content) end end |
#negative_failure_message ⇒ Object
Returns
- String
-
The failure message to be displayed in negative matches.
310 311 312 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 310 def "expected the following element's content to not #{}:\n#{@element.inner_text}" end |