class Bbq::RSpec::Matchers::See::Matcher
Attributes
scope[R]
text[R]
Public Class Methods
new(text)
click to toggle source
# File lib/bbq/rspec/matchers/see.rb, line 8 def initialize(text) @text = text @scope = nil end
Public Instance Methods
description()
click to toggle source
# 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)
click to toggle source
# 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()
click to toggle source
# File lib/bbq/rspec/matchers/see.rb, line 31 def failure_message_for_should "expected to see \"#{text}\" in #{format(@actual.text)}" end
Also aliased as: failure_message
failure_message_for_should_not()
click to toggle source
# File lib/bbq/rspec/matchers/see.rb, line 36 def failure_message_for_should_not "expected not to see \"#{text}\" in #{format(@actual.text)}" end
Also aliased as: failure_message_when_negated
matches?(actor)
click to toggle source
# File lib/bbq/rspec/matchers/see.rb, line 21 def matches?(actor) @actual = page_fragment(actor) @actual.has_text?(text) end
within(scope)
click to toggle source
# File lib/bbq/rspec/matchers/see.rb, line 41 def within(scope) @scope = scope self end
Private Instance Methods
format(text)
click to toggle source
# File lib/bbq/rspec/matchers/see.rb, line 55 def format(text) case text when Regexp text.inspect else text.to_s.gsub(/[[:space:]]+/, ' ').strip.inspect end end
page_fragment(actor)
click to toggle source
# File lib/bbq/rspec/matchers/see.rb, line 47 def page_fragment(actor) if scope actor.page.first(*scope) else actor.page end end