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:
parent
6a924d6b1f
commit
ce8c620a46
2 changed files with 7 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
class MultipleTransitionsThatDifferOnlyByGuard
|
||||
include AASM
|
||||
|
||||
attr_accessor :executed_correctly
|
||||
attr_accessor :executed_second
|
||||
|
||||
aasm do
|
||||
state :start, :initial => true
|
||||
|
@ -26,6 +26,6 @@ class MultipleTransitionsThatDifferOnlyByGuard
|
|||
end
|
||||
|
||||
def this_should_execute
|
||||
self.executed_correctly = true
|
||||
self.executed_second = true
|
||||
end
|
||||
end
|
|
@ -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
|
||||
expect{job.go}.not_to raise_error
|
||||
end
|
||||
|
||||
it 'executes the second transition\'s callbacks' do
|
||||
job.go
|
||||
expect(job.executed_second).to be_truthy
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue