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.
236 237 238 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 236 def initialize(content) @content = content end |
Instance Method Details
#content_message ⇒ Object
263 264 265 266 267 268 269 270 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 263 def case @content when String "include \"#{@content}\"" when Regexp "match #{@content.inspect}" end end |
#failure_message ⇒ Object
Returns
- String
-
The failure message.
253 254 255 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 253 def "expected the following element's content to #{}:\n#{@element.inner_text}" end |
#matches?(element) ⇒ Boolean
240 241 242 243 244 245 246 247 248 249 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 240 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.
259 260 261 |
# File 'lib/merb-core/test/matchers/view_matchers.rb', line 259 def "expected the following element's content to not #{}:\n#{@element.inner_text}" end |