spec/spec_helper.rb in formulaic-0.3.0 vs spec/spec_helper.rb in formulaic-0.4.0

- old
+ new

@@ -1,7 +1,9 @@ require 'formulaic' +Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f } + module SpecHelper def input(model, field) page.find("##{model}_#{field}") end @@ -14,12 +16,18 @@ Capybara.app = Rack::File.new(File.expand_path('../fixtures', __FILE__)) Capybara.current_session end end - def load_translations + 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 @@ -33,10 +41,15 @@ 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: - @@ -54,8 +67,12 @@ - Diciembre TRANSLATIONS end end -RSpec.configure do |c| - c.include SpecHelper +RSpec.configure do |config| + config.include SpecHelper + + config.before(:each) do + reset_and_load_translations + end end