Module: Hermes::Actions

Included in:
IntegrationCase
Defined in:
lib/hermes/actions.rb

Overview

A few actions built on top of Capybara.

Constant Summary collapse

POSTFIXES =
{
  :year   => '1i',
  :month  => '2i',
  :day    => '3i',
  :hour   => '4i',
  :minute => '5i'
}.freeze

Instance Method Summary collapse

Instance Method Details

#select_date(date, options = {}) ⇒ Object



32
33
34
35
36
37
# File 'lib/hermes/actions.rb', line 32

def select_date(date, options={})
  select_prefix = select_prefix_from_options(options)
  find_and_select_option(select_prefix, POSTFIXES[:year], date.year)
  find_and_select_option(select_prefix, POSTFIXES[:month], date.month)
  find_and_select_option(select_prefix, POSTFIXES[:day], date.day)
end

#select_datetime(datetime, options = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/hermes/actions.rb', line 13

def select_datetime(datetime, options={})
  select_prefix = select_prefix_from_options(options)

  select_time(datetime, :id_prefix => select_prefix)
  select_date(datetime, :id_prefix => select_prefix)
end

#select_time(time, options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/hermes/actions.rb', line 20

def select_time(time, options={})
  select_prefix = select_prefix_from_options(options)

  find_and_select_option(select_prefix,
                         POSTFIXES[:hour],
                         string_with_double_digits(time.hour))

  find_and_select_option(select_prefix,
                         POSTFIXES[:minute],
                         string_with_double_digits(time.min))
end