From df02384dbea9201d35704b8f429ff09706354959 Mon Sep 17 00:00:00 2001 From: Daniel Miranda Date: Fri, 10 Apr 2015 17:29:33 -0300 Subject: [PATCH] Force acceptance tests to use the default locale --- features/support/hooks.rb | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/features/support/hooks.rb b/features/support/hooks.rb index 17daaad..eca93f5 100644 --- a/features/support/hooks.rb +++ b/features/support/hooks.rb @@ -1,7 +1,17 @@ After do |scenario| -# Do something after each scenario. -# The +scenario+ argument is optional, but -# if you use it, you can inspect status with -# the #failed?, #passed? and #exception methods. -Rails.cache.clear -end \ No newline at end of file + # Do something after each scenario. + # The +scenario+ argument is optional, but + # if you use it, you can inspect status with + # the #failed?, #passed? and #exception methods. + Rails.cache.clear +end + +# Run all acceptance tests on the default language +Before do |scenario| + if defined?(page) && ! page.driver.nil? + header_method = [:add_header, :header].find(&page.driver.method(:respond_to?)) + page.driver.send(header_method, 'Accept-Language', I18n.default_locale) if header_method + end + + I18n.locale = I18n.default_locale +end -- libgit2 0.21.2