2012-12-04 16:27:47 +13:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'initial states' do
|
|
|
|
it 'should use the first state defined if no initial state is given' do
|
2015-05-15 22:50:29 +12:00
|
|
|
expect(NoInitialState.new.aasm.current_state).to eq(:read)
|
2012-12-04 16:27:47 +13:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should determine initial state from the Proc results' do
|
2015-05-15 22:50:29 +12:00
|
|
|
expect(InitialStateProc.new(InitialStateProc::RICH - 1).aasm.current_state).to eq(:selling_bad_mortgages)
|
|
|
|
expect(InitialStateProc.new(InitialStateProc::RICH + 1).aasm.current_state).to eq(:retired)
|
2012-12-04 16:27:47 +13:00
|
|
|
end
|
|
|
|
end
|