Class: Bbq::RSpec::Matchers::See::Matcher
- Inherits:
-
Object
- Object
- Bbq::RSpec::Matchers::See::Matcher
- Defined in:
- lib/bbq/rspec/matchers/see.rb
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #description ⇒ Object
- #does_not_match?(actor) ⇒ Boolean
- #failure_message_for_should ⇒ Object (also: #failure_message)
- #failure_message_for_should_not ⇒ Object (also: #failure_message_when_negated)
-
#initialize(text) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches?(actor) ⇒ Boolean
- #within(scope) ⇒ Object
Constructor Details
#initialize(text) ⇒ Matcher
Returns a new instance of Matcher.
8 9 10 11 |
# File 'lib/bbq/rspec/matchers/see.rb', line 8 def initialize(text) @text = text @scope = nil end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
6 7 8 |
# File 'lib/bbq/rspec/matchers/see.rb', line 6 def scope @scope end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
6 7 8 |
# File 'lib/bbq/rspec/matchers/see.rb', line 6 def text @text end |
Instance Method Details
#description ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/bbq/rspec/matchers/see.rb', line 13 def description if scope "see #{text} within #{scope}" else "see #{text}" end end |
#does_not_match?(actor) ⇒ Boolean
26 27 28 29 |
# File 'lib/bbq/rspec/matchers/see.rb', line 26 def does_not_match?(actor) @actual = page_fragment(actor) @actual.has_no_text?(text) end |
#failure_message_for_should ⇒ Object Also known as: failure_message
31 32 33 |
# File 'lib/bbq/rspec/matchers/see.rb', line 31 def "expected to see \"#{text}\" in #{format(@actual.text)}" end |
#failure_message_for_should_not ⇒ Object Also known as: failure_message_when_negated
36 37 38 |
# File 'lib/bbq/rspec/matchers/see.rb', line 36 def "expected not to see \"#{text}\" in #{format(@actual.text)}" end |
#matches?(actor) ⇒ Boolean
21 22 23 24 |
# File 'lib/bbq/rspec/matchers/see.rb', line 21 def matches?(actor) @actual = page_fragment(actor) @actual.has_text?(text) end |
#within(scope) ⇒ Object
41 42 43 44 |
# File 'lib/bbq/rspec/matchers/see.rb', line 41 def within(scope) @scope = scope self end |