Class: RSpec::TagMatchers::HasCheckbox
Overview
A matcher that matches <input type="checkbox"> tags.
Instance Method Summary (collapse)
-
- (HasCheckbox) checked
Specifies that the checkbox must be selected.
-
- (HasCheckbox) initialize
constructor
Initializes a HasCheckbox matcher that matches elements named input with a type attribute of checkbox.
-
- (HasCheckbox) not_checked
Specifies that the checkbox must not be selected.
Methods inherited from HasInput
Methods inherited from HasTag
#description, #failure_message, #matches?, #negative_failure_message, #with_attribute, #with_content, #with_count, #with_criteria
Methods included from RSpec::TagMatchers::Helpers::SentenceHelper
Constructor Details
- (HasCheckbox) initialize
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
- (HasCheckbox) checked
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 |
- (HasCheckbox) not_checked
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 |