Restructure error sentence per @alto suggestion

Fix failing spec by adding period
Use upstream version of Proc handling
Fix spacing
Restart travis
This commit is contained in:
Chris Woodrich 2016-01-10 15:13:38 -08:00
parent 80b941f277
commit 134129ee82
3 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ module AASM::Core
failures << code unless result failures << code unless result
result result
when Proc when Proc
result = (code.arity == 0 ? record.instance_exec(&code) : record.instance_exec(*args, &code)) result = (code.parameters.size == 0 ? record.instance_exec(&code) : record.instance_exec(*args, &code))
failures << code.source_location.join('#') unless result failures << code.source_location.join('#') unless result
result result
when Array when Array

View File

@ -10,11 +10,11 @@ module AASM
end end
def message def message
"Event '#{event_name}' cannot transition from '#{object.aasm(state_machine_name).current_state}'#{reasoning}" "Event '#{event_name}' cannot transition from '#{object.aasm(state_machine_name).current_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

View File

@ -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