Class: Conformity::SuccessConditions
- Inherits:
-
Object
- Object
- Conformity::SuccessConditions
- Defined in:
- lib/conformity/success_conditions.rb
Instance Method Summary collapse
- #has_content?(content) ⇒ Boolean
- #has_status_code?(status_code) ⇒ Boolean
-
#initialize(session = Capybara.current_session) ⇒ SuccessConditions
constructor
A new instance of SuccessConditions.
- #success? ⇒ Boolean
Constructor Details
#initialize(session = Capybara.current_session) ⇒ SuccessConditions
Returns a new instance of SuccessConditions.
4 5 6 7 |
# File 'lib/conformity/success_conditions.rb', line 4 def initialize(session = Capybara.current_session) @session = session @conditions = [] end |
Instance Method Details
#has_content?(content) ⇒ Boolean
9 10 11 12 13 |
# File 'lib/conformity/success_conditions.rb', line 9 def has_content?(content) add_condition do session.has_content?(content) end end |
#has_status_code?(status_code) ⇒ Boolean
15 16 17 18 19 |
# File 'lib/conformity/success_conditions.rb', line 15 def has_status_code?(status_code) add_condition do session.status_code == status_code end end |
#success? ⇒ Boolean
21 22 23 |
# File 'lib/conformity/success_conditions.rb', line 21 def success? conditions.all? { |condition| condition.call() } end |