File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 7
7
let ( :key ) { :invalid_formatter }
8
8
let ( :attributes ) { { klass : String , to_format : 'xml' } }
9
9
10
- before { I18n . default_locale = :de }
11
10
after do
12
11
I18n . available_locales = %i[ en ]
13
- I18n . enforce_available_locales = false
12
+ I18n . default_locale = :en
14
13
end
15
14
16
15
context 'when I18n enforces available locales' do
17
16
before { I18n . enforce_available_locales = true }
18
17
19
18
context 'when the fallback locale is available' do
20
- before { I18n . available_locales = %i[ de en ] }
19
+ before do
20
+ I18n . available_locales = %i[ de en ]
21
+ I18n . default_locale = :de
22
+ end
21
23
22
24
it 'returns the translated message' do
23
25
expect ( subject ) . to eq ( 'cannot convert String to xml' )
24
26
end
25
27
end
26
28
27
29
context 'when the fallback locale is not available' do
28
- before { I18n . available_locales = %i[ de jp ] }
30
+ before do
31
+ I18n . available_locales = %i[ de jp ]
32
+ I18n . default_locale = :de
33
+ end
29
34
30
35
it 'returns the translation string' do
31
36
expect ( subject ) . to eq ( "grape.errors.messages.#{ key } " )
Original file line number Diff line number Diff line change 12
12
require file
13
13
end
14
14
15
- I18n . enforce_available_locales = false
15
+ I18n . enforce_available_locales = true
16
16
17
17
RSpec . configure do |config |
18
18
config . include Rack ::Test ::Methods
You can’t perform that action at this time.
0 commit comments