mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
Adds specs for state#display_name for localization
This commit is contained in:
parent
26a2ab5a8d
commit
86c20d5197
3 changed files with 21 additions and 0 deletions
|
@ -4,3 +4,10 @@ en:
|
|||
localizer_test_model:
|
||||
aasm_state:
|
||||
opened: "It's open now!"
|
||||
|
||||
fr:
|
||||
activerecord:
|
||||
attributes:
|
||||
localizer_test_model:
|
||||
aasm_state:
|
||||
opened: "C'est ouvert maintenant!"
|
||||
|
|
|
@ -3,3 +3,9 @@ en:
|
|||
attributes:
|
||||
localizer_test_model:
|
||||
aasm_state/opened: "It's open now!"
|
||||
|
||||
fr:
|
||||
activerecord:
|
||||
attributes:
|
||||
localizer_test_model:
|
||||
aasm_state/opened: "C'est ouvert maintenant!"
|
|
@ -24,11 +24,19 @@ describe 'localized state names' do
|
|||
state = LocalizerTestModel.aasm.states.detect {|s| s == :opened}
|
||||
expect(state.localized_name).to eq("It's open now!")
|
||||
expect(state.human_name).to eq("It's open now!")
|
||||
expect(state.display_name).to eq("It's open now!")
|
||||
|
||||
I18n.with_locale(:fr) do
|
||||
expect(state.localized_name).to eq("C'est ouvert maintenant!")
|
||||
expect(state.human_name).to eq("C'est ouvert maintenant!")
|
||||
expect(state.display_name).to eq("C'est ouvert maintenant!")
|
||||
end
|
||||
end
|
||||
|
||||
it 'should use fallback' do
|
||||
state = LocalizerTestModel.aasm.states.detect {|s| s == :closed}
|
||||
expect(state.localized_name).to eq('Closed')
|
||||
expect(state.human_name).to eq('Closed')
|
||||
expect(state.display_name).to eq('Closed')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue