Skip to content

Commit

Permalink
Adds spec for #human_event_name to accept event object
Browse files Browse the repository at this point in the history
  • Loading branch information
the-spectator authored and Anil Kumar Maurya committed Mar 26, 2021
1 parent adfeeb5 commit 6a3aef9
Showing 1 changed file with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions spec/unit/localizer_spec.rb
Expand Up @@ -29,12 +29,28 @@
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
Expand Down Expand Up @@ -65,12 +81,28 @@
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
Expand Down

0 comments on commit 6a3aef9

Please sign in to comment.