Remove trailing space from error message
This commit is contained in:
parent
f9048b7496
commit
5e29fe5de4
|
@ -7,11 +7,11 @@ module AASM
|
||||||
|
|
||||||
def initialize(object, event_name, state_machine_name, failures = [])
|
def initialize(object, event_name, state_machine_name, failures = [])
|
||||||
@object, @event_name, @originating_state, @failures = object, event_name, object.aasm(state_machine_name).current_state, failures
|
@object, @event_name, @originating_state, @failures = object, event_name, object.aasm(state_machine_name).current_state, failures
|
||||||
super("Event '#{event_name}' cannot transition from '#{originating_state}'. #{reasoning}")
|
super("Event '#{event_name}' cannot transition from '#{originating_state}'.#{reasoning}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def reasoning
|
def reasoning
|
||||||
"Failed callback(s): #{failures}." unless failures.empty?
|
" Failed callback(s): #{failures}." unless failures.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe AASM::InvalidTransition do
|
||||||
process = ProcessWithNewDsl.new
|
process = ProcessWithNewDsl.new
|
||||||
expect { process.stop! }.to raise_error do |err|
|
expect { process.stop! }.to raise_error do |err|
|
||||||
process.start
|
process.start
|
||||||
expect(err.message).to eql("Event 'stop' cannot transition from 'sleeping'. ")
|
expect(err.message).to eql("Event 'stop' cannot transition from 'sleeping'.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe 'transitions' do
|
||||||
process = ProcessWithNewDsl.new
|
process = ProcessWithNewDsl.new
|
||||||
expect { process.stop! }.to raise_error do |err|
|
expect { process.stop! }.to raise_error do |err|
|
||||||
expect(err.class).to eql(AASM::InvalidTransition)
|
expect(err.class).to eql(AASM::InvalidTransition)
|
||||||
expect(err.message).to eql("Event 'stop' cannot transition from 'sleeping'. ")
|
expect(err.message).to eql("Event 'stop' cannot transition from 'sleeping'.")
|
||||||
expect(err.object).to eql(process)
|
expect(err.object).to eql(process)
|
||||||
expect(err.event_name).to eql(:stop)
|
expect(err.event_name).to eql(:stop)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue