2014-07-25 12:05:31 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "event naming" do
|
2015-05-18 04:40:54 -04:00
|
|
|
let(:state_machine) { StateMachineWithFailedEvent.new }
|
2014-07-25 12:05:31 -04:00
|
|
|
|
2015-05-18 04:40:54 -04:00
|
|
|
it "allows an event of failed without blowing the stack aka stack level too deep" do
|
2014-07-25 12:05:31 -04:00
|
|
|
state_machine.failed
|
|
|
|
expect { state_machine.failed }.to raise_error(AASM::InvalidTransition)
|
|
|
|
end
|
2016-01-07 22:08:43 -05:00
|
|
|
|
|
|
|
it "allows send as event name" do
|
|
|
|
expect(state_machine.aasm.current_state).to eq :init
|
|
|
|
state_machine.send
|
|
|
|
expect(state_machine.aasm.current_state).to eq :sent
|
|
|
|
end
|
2014-07-25 12:05:31 -04:00
|
|
|
end
|