Commit df02384dbea9201d35704b8f429ff09706354959
Committed by
Rafael Manzo
1 parent
b7abbd1d
Exists in
colab
and in
4 other branches
Force acceptance tests to use the default locale
Showing
1 changed file
with
16 additions
and
6 deletions
Show diff stats
features/support/hooks.rb
| 1 | 1 | After do |scenario| |
| 2 | -# Do something after each scenario. | |
| 3 | -# The +scenario+ argument is optional, but | |
| 4 | -# if you use it, you can inspect status with | |
| 5 | -# the #failed?, #passed? and #exception methods. | |
| 6 | -Rails.cache.clear | |
| 7 | -end | |
| 8 | 2 | \ No newline at end of file |
| 3 | + # Do something after each scenario. | |
| 4 | + # The +scenario+ argument is optional, but | |
| 5 | + # if you use it, you can inspect status with | |
| 6 | + # the #failed?, #passed? and #exception methods. | |
| 7 | + Rails.cache.clear | |
| 8 | +end | |
| 9 | + | |
| 10 | +# Run all acceptance tests on the default language | |
| 11 | +Before do |scenario| | |
| 12 | + if defined?(page) && ! page.driver.nil? | |
| 13 | + header_method = [:add_header, :header].find(&page.driver.method(:respond_to?)) | |
| 14 | + page.driver.send(header_method, 'Accept-Language', I18n.default_locale) if header_method | |
| 15 | + end | |
| 16 | + | |
| 17 | + I18n.locale = I18n.default_locale | |
| 18 | +end | ... | ... |