Class: PageMatch::Page
- Inherits:
-
Object
- Object
- PageMatch::Page
- Defined in:
- lib/page_match/page.rb
Instance Attribute Summary collapse
-
#contain ⇒ Object
Returns the value of attribute contain.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#did ⇒ Object
Returns the value of attribute did.
-
#did_not ⇒ Object
Returns the value of attribute did_not.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#not_contain ⇒ Object
Returns the value of attribute not_contain.
Class Method Summary collapse
Instance Method Summary collapse
- #failure_message ⇒ Object
- #have(msg = '') ⇒ Object
-
#initialize ⇒ Page
constructor
A new instance of Page.
- #matches?(page_instance) ⇒ Boolean
- #negative_failure_message ⇒ Object
- #page(&block) ⇒ Object
Constructor Details
#initialize ⇒ Page
Returns a new instance of Page.
6 7 8 9 10 11 |
# File 'lib/page_match/page.rb', line 6 def initialize @contain = %(expected the page to contain) @not_contain = %(expected the page to not contain) @did = %(but it did) @did_not = %(but it didn't) end |
Instance Attribute Details
#contain ⇒ Object
Returns the value of attribute contain.
4 5 6 |
# File 'lib/page_match/page.rb', line 4 def contain @contain end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/page_match/page.rb', line 3 def description @description end |
#did ⇒ Object
Returns the value of attribute did.
4 5 6 |
# File 'lib/page_match/page.rb', line 4 def did @did end |
#did_not ⇒ Object
Returns the value of attribute did_not.
4 5 6 |
# File 'lib/page_match/page.rb', line 4 def did_not @did_not end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/page_match/page.rb', line 3 def @message end |
#not_contain ⇒ Object
Returns the value of attribute not_contain.
4 5 6 |
# File 'lib/page_match/page.rb', line 4 def not_contain @not_contain end |
Class Method Details
Instance Method Details
#failure_message ⇒ Object
28 29 30 |
# File 'lib/page_match/page.rb', line 28 def %(#{contain} #{}, #{did_not}) end |
#have(msg = '') ⇒ Object
23 24 25 26 |
# File 'lib/page_match/page.rb', line 23 def have(msg='') @message = msg @description = %(have #{msg}) end |
#matches?(page_instance) ⇒ Boolean
36 37 38 |
# File 'lib/page_match/page.rb', line 36 def matches?(page_instance) page_instance.instance_eval(&@page_block) end |
#negative_failure_message ⇒ Object
32 33 34 |
# File 'lib/page_match/page.rb', line 32 def %(#{not_contain} #{}, #{did}) end |
#page(&block) ⇒ Object
19 20 21 |
# File 'lib/page_match/page.rb', line 19 def page(&block) @page_block = block end |