Module: Kelp::Checkbox

Includes:
Helper, Scoping
Defined in:
lib/kelp/checkbox.rb

Instance Method Summary collapse

Methods included from Helper

#listify, #nice_find_field, #rspec_unexpected

Methods included from Scoping

#in_scope, #kelp_within, #scope_within

Instance Method Details

#checkbox_should_be_checked(checkbox, scope = {}) ⇒ Object

Verify that the given checkbox is checked.

Raises:

Since:

  • 0.1.2



22
23
24
25
26
27
28
29
30
# File 'lib/kelp/checkbox.rb', line 22

def checkbox_should_be_checked(checkbox, scope={})
  in_scope(scope) do
    field_checked = find_field(checkbox)['checked']
    if !field_checked
      raise Kelp::Unexpected,
        "Expected '#{checkbox}' to be checked, but it is unchecked."
    end
  end
end

#checkbox_should_not_be_checked(checkbox, scope = {}) ⇒ Object

Verify that the given checkbox is not checked.

Raises:

Since:

  • 0.1.2



45
46
47
48
49
50
51
52
53
# File 'lib/kelp/checkbox.rb', line 45

def checkbox_should_not_be_checked(checkbox, scope={})
  in_scope(scope) do
    field_checked = find_field(checkbox)['checked']
    if field_checked
      raise Kelp::Unexpected,
        "Expected '#{checkbox}' to be unchecked, but it is checked."
    end
  end
end