1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

better naming (test classes)

This commit is contained in:
Thorsten Böttger 2012-12-02 20:54:58 +13:00
parent d8b8d5f5c3
commit 6160269635
3 changed files with 48 additions and 49 deletions

View file

@ -150,44 +150,44 @@ describe 'executing the success callback' do
end
describe 'parametrised events' do
let(:cp) {ChetanPatil.new}
let(:pe) {ParametrisedEvent.new}
it 'should transition to specified next state (sleeping to showering)' do
cp.wakeup!(:showering)
cp.aasm_current_state.should == :showering
pe.wakeup!(:showering)
pe.aasm_current_state.should == :showering
end
it 'should transition to specified next state (sleeping to working)' do
cp.wakeup!(:working)
cp.aasm_current_state.should == :working
pe.wakeup!(:working)
pe.aasm_current_state.should == :working
end
it 'should transition to default (first or showering) state' do
cp.wakeup!
cp.aasm_current_state.should == :showering
pe.wakeup!
pe.aasm_current_state.should == :showering
end
it 'should transition to default state when on_transition invoked' do
cp.dress!(nil, 'purple', 'dressy')
cp.aasm_current_state.should == :working
pe.dress!(nil, 'purple', 'dressy')
pe.aasm_current_state.should == :working
end
it 'should call on_transition method with args' do
cp.wakeup!(:showering)
cp.should_receive(:wear_clothes).with('blue', 'jeans')
cp.dress!(:working, 'blue', 'jeans')
pe.wakeup!(:showering)
pe.should_receive(:wear_clothes).with('blue', 'jeans')
pe.dress!(:working, 'blue', 'jeans')
end
it 'should call on_transition proc' do
cp.wakeup!(:showering)
cp.should_receive(:wear_clothes).with('purple', 'slacks')
cp.dress!(:dating, 'purple', 'slacks')
pe.wakeup!(:showering)
pe.should_receive(:wear_clothes).with('purple', 'slacks')
pe.dress!(:dating, 'purple', 'slacks')
end
it 'should call on_transition with an array of methods' do
cp.wakeup!(:showering)
cp.should_receive(:condition_hair)
cp.should_receive(:fix_hair)
cp.dress!(:prettying_up)
pe.wakeup!(:showering)
pe.should_receive(:condition_hair)
pe.should_receive(:fix_hair)
pe.dress!(:prettying_up)
end
end