Module: RSpecHTML::Countable
- Included in:
- Matchers::ContainTag, Matchers::MatchText
- Defined in:
- lib/rspec_html/countable.rb
Overview
DSL module for all matchers, provides element counting utilities.
Instance Method Summary collapse
- #at_least(count = nil) ⇒ Object
- #at_most(count = nil) ⇒ Object
- #once ⇒ Object
- #times(count) ⇒ Object
- #twice ⇒ Object
Instance Method Details
#at_least(count = nil) ⇒ Object
24 25 26 27 28 |
# File 'lib/rspec_html/countable.rb', line 24 def at_least(count = nil) @expected_count = { once: 1, twice: 2 }.fetch(count, nil) @expected_count_type = :at_least self end |
#at_most(count = nil) ⇒ Object
30 31 32 33 34 |
# File 'lib/rspec_html/countable.rb', line 30 def at_most(count = nil) @expected_count = { once: 1, twice: 2 }.fetch(count, nil) @expected_count_type = :at_most self end |
#once ⇒ Object
6 7 8 9 10 |
# File 'lib/rspec_html/countable.rb', line 6 def once @expected_count = 1 @expected_count_type ||= :exact self end |
#times(count) ⇒ Object
18 19 20 21 22 |
# File 'lib/rspec_html/countable.rb', line 18 def times(count) @expected_count = count @expected_count_type ||= :exact self end |
#twice ⇒ Object
12 13 14 15 16 |
# File 'lib/rspec_html/countable.rb', line 12 def twice @expected_count = 2 @expected_count_type ||= :exact self end |