mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
Adds spec for #human_event_name to accept event object
This commit is contained in:
parent
adfeeb5967
commit
6a3aef9526
1 changed files with 40 additions and 8 deletions
|
@ -29,12 +29,28 @@ if defined?(ActiveRecord)
|
|||
end
|
||||
|
||||
context 'aasm.human_event_name' do
|
||||
it 'should return translated event name' do
|
||||
expect(LocalizerTestModel.aasm.human_event_name(:close)).to eq("Let's close it!")
|
||||
context 'with event name' do
|
||||
it 'should return translated event name' do
|
||||
expect(LocalizerTestModel.aasm.human_event_name(:close)).to eq("Let's close it!")
|
||||
end
|
||||
|
||||
it 'should return humanized event name' do
|
||||
expect(LocalizerTestModel.aasm.human_event_name(:open)).to eq("Open")
|
||||
end
|
||||
end
|
||||
|
||||
it 'should return humanized event name' do
|
||||
expect(LocalizerTestModel.aasm.human_event_name(:open)).to eq("Open")
|
||||
context 'with event object' do
|
||||
it 'should return translated event name' do
|
||||
event = LocalizerTestModel.aasm.events.detect { |e| e.name == :close }
|
||||
|
||||
expect(LocalizerTestModel.aasm.human_event_name(event)).to eq("Let's close it!")
|
||||
end
|
||||
|
||||
it 'should return humanized event name' do
|
||||
event = LocalizerTestModel.aasm.events.detect { |e| e.name == :open }
|
||||
|
||||
expect(LocalizerTestModel.aasm.human_event_name(event)).to eq("Open")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -65,12 +81,28 @@ if defined?(ActiveRecord)
|
|||
end
|
||||
|
||||
context 'aasm.human_event_name' do
|
||||
it 'should return translated event name' do
|
||||
expect(LocalizerTestModel.aasm.human_event_name(:close)).to eq("Let's close it!")
|
||||
context 'with event name' do
|
||||
it 'should return translated event name' do
|
||||
expect(LocalizerTestModel.aasm.human_event_name(:close)).to eq("Let's close it!")
|
||||
end
|
||||
|
||||
it 'should return humanized event name' do
|
||||
expect(LocalizerTestModel.aasm.human_event_name(:open)).to eq("Open")
|
||||
end
|
||||
end
|
||||
|
||||
it 'should return humanized event name' do
|
||||
expect(LocalizerTestModel.aasm.human_event_name(:open)).to eq("Open")
|
||||
context 'with event object' do
|
||||
it 'should return translated event name' do
|
||||
event = LocalizerTestModel.aasm.events.detect { |e| e.name == :close }
|
||||
|
||||
expect(LocalizerTestModel.aasm.human_event_name(event)).to eq("Let's close it!")
|
||||
end
|
||||
|
||||
it 'should return humanized event name' do
|
||||
event = LocalizerTestModel.aasm.events.detect { |e| e.name == :open }
|
||||
|
||||
expect(LocalizerTestModel.aasm.human_event_name(event)).to eq("Open")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue