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

Add test to verify the correct transition's callbacks actually run

This commit is contained in:
Dathan Bennett 2016-10-12 13:56:00 -07:00
parent 6a924d6b1f
commit ce8c620a46
2 changed files with 7 additions and 2 deletions

View file

@ -1,7 +1,7 @@
class MultipleTransitionsThatDifferOnlyByGuard class MultipleTransitionsThatDifferOnlyByGuard
include AASM include AASM
attr_accessor :executed_correctly attr_accessor :executed_second
aasm do aasm do
state :start, :initial => true state :start, :initial => true
@ -26,6 +26,6 @@ class MultipleTransitionsThatDifferOnlyByGuard
end end
def this_should_execute def this_should_execute
self.executed_correctly = true self.executed_second = true
end end
end end

View file

@ -6,4 +6,9 @@ describe "multiple transitions that differ only by guard" do
it 'does not follow the first transition if its guard fails' do it 'does not follow the first transition if its guard fails' do
expect{job.go}.not_to raise_error expect{job.go}.not_to raise_error
end end
it 'executes the second transition\'s callbacks' do
job.go
expect(job.executed_second).to be_truthy
end
end end