2014-07-25 09:05:31 -07:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "event naming" do
|
2015-05-18 20:40:54 +12:00
|
|
|
let(:state_machine) { StateMachineWithFailedEvent.new }
|
2014-07-25 09:05:31 -07:00
|
|
|
|
2015-05-18 20:40:54 +12:00
|
|
|
it "allows an event of failed without blowing the stack aka stack level too deep" do
|
2014-07-25 09:05:31 -07:00
|
|
|
state_machine.failed
|
|
|
|
expect { state_machine.failed }.to raise_error(AASM::InvalidTransition)
|
|
|
|
end
|
2016-01-08 16:08:43 +13: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 09:05:31 -07:00
|
|
|
end
|