Class: RSpec::TagMatchers::HasCheckbox
- Defined in:
- lib/rspec/tag_matchers/has_checkbox.rb
Overview
A matcher that matches <input type="checkbox">
tags.
Instance Method Summary collapse
-
#checked ⇒ HasCheckbox
Specifies that the checkbox must be selected.
-
#initialize ⇒ HasCheckbox
constructor
Initializes a HasCheckbox matcher that matches elements named
input
with atype
attribute ofcheckbox
. -
#not_checked ⇒ HasCheckbox
Specifies that the checkbox must not be selected.
Methods inherited from HasInput
Methods inherited from HasTag
#description, #failure_message, #matches?, #negative_failure_message, #test_attribute, #with_attribute, #with_content, #with_count, #with_criteria
Methods included from RSpec::TagMatchers::Helpers::SentenceHelper
Constructor Details
#initialize ⇒ HasCheckbox
Initializes a HasCheckbox matcher that matches elements named input
with a type
attribute of checkbox
.
29 30 31 32 |
# File 'lib/rspec/tag_matchers/has_checkbox.rb', line 29 def initialize super with_attribute(:type => :checkbox) end |
Instance Method Details
#checked ⇒ HasCheckbox
Specifies that the checkbox must be selected. A checkbox is considered to be checked if it has a checked
attribute.
43 44 45 46 |
# File 'lib/rspec/tag_matchers/has_checkbox.rb', line 43 def checked with_attribute(:checked => true) self end |
#not_checked ⇒ HasCheckbox
Specifies that the checkbox must not be selected. A checkbox is not checked if it has no checked
attribute.
55 56 57 58 |
# File 'lib/rspec/tag_matchers/has_checkbox.rb', line 55 def not_checked with_attribute(:checked => false) self end |