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
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

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
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