-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding first version of before and after callbacks
This commit adds the initial tests and implementation for before and after callbacks. It follows a similar implementation to the guard fucntions, relying on rescuing the specific exceptions.
- Loading branch information
1 parent
b1a7759
commit c548f6c
Showing
4 changed files
with
91 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
defmodule MachineryTest.TransitionTest do | ||
use ExUnit.Case | ||
doctest Machinery.Transition | ||
alias Machinery.Transition | ||
|
||
test "declared_transition?/3 based on a map of transitions, current and next state" do | ||
transitions = %{ | ||
created: [:partial, :completed], | ||
partial: :completed | ||
} | ||
assert Transition.declared_transition?(transitions, :created, :partial) | ||
assert Transition.declared_transition?(transitions, :created, :completed) | ||
assert Transition.declared_transition?(transitions, :partial, :completed) | ||
refute Transition.declared_transition?(transitions, :partial, :created) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters