Sha256: b4fd65f5f474e699485a82d1a0c62208e30ca8d9c3257dc89c65aa6a7ecf63a3

Contents?: true

Size: 1.87 KB

Versions: 2

Compression:

Stored size: 1.87 KB

Contents

require 'formulaic'

Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f }

module SpecHelper
  def input(model, field)
    page.find("##{model}_#{field}")
  end

  def visit(page_name)
    page.visit("/#{page_name}.html")
  end

  def page
    @page ||= begin
                Capybara.app = Rack::File.new(File.expand_path('../fixtures', __FILE__))
                Capybara.current_session
              end
  end

  def reset_and_load_translations
    I18n.reload!
    I18n.backend.store_translations(:en, YAML.load(<<-TRANSLATIONS))
        helpers:
          submit:
            create: 'Create %{model}'
            update: 'Update %{model}'
            submit: 'Save %{model}'
        simple_form:
          labels:
            user:
              age: Your Age
              avatar: Your Avatar
              awesome: Are you awesome?
              bio: Biography
              date_of_birth: Your Date of birth
              likes: Your Likes
              dislikes: Your Dislikes
              email: Your Email
              name: Your Display name
              new:
                password: Your Password
                phone: Phone Number
                terms_of_service: I agree to the Terms of Service
                url: Website
          options:
            user:
              role:
                admin: Administrator
                member: Member
    TRANSLATIONS
    I18n.backend.store_translations(:es, YAML.load(<<-TRANSLATIONS))
      date:
        month_names:
          -
          - Enero
          - Febrero
          - Marzo
          - Abril
          - Mayo
          - Junio
          - Julio
          - Agosto
          - Septiembre
          - Octubre
          - Noviembre
          - Diciembre
    TRANSLATIONS
  end
end

RSpec.configure do |config|
  config.include SpecHelper

  config.before(:each) do
    reset_and_load_translations
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
formulaic-0.4.1 spec/spec_helper.rb
formulaic-0.4.0 spec/spec_helper.rb