Class: Locator::Matcher::HaveCssClass

Inherits:
Object
  • Object
show all
Defined in:
lib/locator/matcher/have_css_class.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(css_class) ⇒ HaveCssClass

Returns a new instance of HaveCssClass.



6
7
8
# File 'lib/locator/matcher/have_css_class.rb', line 6

def initialize(css_class)
  @css_class = css_class
end

Instance Attribute Details

#css_classObject (readonly)

Returns the value of attribute css_class.



4
5
6
# File 'lib/locator/matcher/have_css_class.rb', line 4

def css_class
  @css_class
end

#targetObject (readonly)

Returns the value of attribute target.



4
5
6
# File 'lib/locator/matcher/have_css_class.rb', line 4

def target
  @target
end

Instance Method Details

#failure_messageObject



15
16
17
# File 'lib/locator/matcher/have_css_class.rb', line 15

def failure_message
  "expected #{target.inspect} to include the css class #{css_class.inspect}"
end

#matches?(target = nil) ⇒ Boolean

Returns:



10
11
12
13
# File 'lib/locator/matcher/have_css_class.rb', line 10

def matches?(target = nil)
  @target = target
  " #{target} ".include?(" #{css_class} ")
end

#negative_failure_messageObject



19
20
21
# File 'lib/locator/matcher/have_css_class.rb', line 19

def negative_failure_message
  "expected #{target.inspect} not to include the css class #{css_class.inspect}"
end