Sha256: 906f84e9cd5b88d61250dd6dd64e5b9f261e39cff53142f0121f80887ab191a9

Contents?: true

Size: 1.18 KB

Versions: 8

Compression:

Stored size: 1.18 KB

Contents

module Ecm
  module Core
    module SpecHelpers
      module Feature
        def sign_in(user)
          visit("/#{I18n.locale}/#{I18n.t('routes.ecm_user_area_engine')}/#{I18n.t('routes.user_session')}/new")
          fill_in 'user_session[email]',    with: user.email
          fill_in 'user_session[password]', with: user.password
          click_button(I18n.t('helpers.submit.user_session.create'))
        end

        def select_date_and_time(date, options = {})
          field = options[:from]
          select I18n.l(date, format: '%Y'),  from: "#{field}_1i" #year
          select I18n.l(date, format: '%B'),  from: "#{field}_2i" #month
          select I18n.l(date, format: '%-d'), from: "#{field}_3i" #day 
          select I18n.l(date, format: '%H'),  from: "#{field}_4i" #hour
          select I18n.l(date, format: '%M'),  from: "#{field}_5i" #minute
        end

        def select_date(date, options = {})
          field = options[:from]
          select I18n.l(date, format: '%Y'),  from: "#{field}_1i" #year
          select I18n.l(date, format: '%B'),  from: "#{field}_2i" #month
          select I18n.l(date, format: '%-d'), from: "#{field}_3i" #day 
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ecm_core-0.4.0 lib/ecm/core/spec_helpers/feature.rb
ecm_core-0.3.0 lib/ecm/core/spec_helpers/feature.rb
ecm_core-0.2.2 lib/ecm/core/spec_helpers/feature.rb
ecm_core-0.2.1 lib/ecm/core/spec_helpers/feature.rb
ecm_core-0.2.0 lib/ecm/core/spec_helpers/feature.rb
ecm_core-0.1.0 lib/ecm/core/spec_helpers/feature.rb
ecm_core-0.0.4 lib/ecm/core/spec_helpers/feature.rb
ecm_core-0.0.3 lib/ecm/core/spec_helpers/feature.rb