Class: Hpricot::Elem
- Inherits:
-
Object
- Object
- Hpricot::Elem
- Defined in:
- merb-core/lib/merb-core/test/test_ext/hpricot.rb
Overview
http://yehudakatz.com/2007/01/27/a-better-assert_select-assert_elements/ based on assert_elements Author: Yehuda Katz Email: wycats @nospam@ gmail.com Web: http://www.yehudakatz.com
which was based on HpricotTestHelper Author: Luke Redpath Email: contact @nospam@ lukeredpath.co.uk Web: www.lukeredpath.co.uk / opensource.agileevolved.com
Instance Method Summary (collapse)
- - (Boolean) contain?(value) (also: #contains?)
-
- (Object) inner_text
courtesy of 'thomas' from the comments of _whys blog - get in touch if you want a better credit!.
- - (Boolean) match?(regex) (also: #matches?)
Instance Method Details
- (Boolean) contain?(value) Also known as: contains?
13 14 15 |
# File 'merb-core/lib/merb-core/test/test_ext/hpricot.rb', line 13 def contain?(value) self.inner_text.include?(value) end |
- (Object) inner_text
courtesy of 'thomas' from the comments of _whys blog - get in touch if you want a better credit!
27 28 29 30 31 |
# File 'merb-core/lib/merb-core/test/test_ext/hpricot.rb', line 27 def inner_text self.children.collect do |child| child.is_a?(Hpricot::Text) ? child.content : ((child.respond_to?("inner_text") && child.inner_text) || "") end.join.strip end |
- (Boolean) match?(regex) Also known as: matches?
19 20 21 |
# File 'merb-core/lib/merb-core/test/test_ext/hpricot.rb', line 19 def match?(regex) self.inner_text.match(regex) end |