-
-
Save tenderlove/ca673b3ce18460890cfd18e09bb1657c to your computer and use it in GitHub Desktop.
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
module ExecutionMethods | |
def curry_one x | |
curry[x].extend ExecutionMethods | |
end | |
alias :to :curry_one | |
alias :on_event :curry_one | |
alias :on :curry_one | |
end | |
class Execution < Proc | |
include ExecutionMethods | |
end | |
class Expectation < Proc | |
alias :to :call | |
end | |
def expect object | |
Expectation.new do |exec| | |
exec.call object | |
end | |
end | |
def transition_from from | |
Execution.new do |to, event, on, thing| | |
p [from, to, event, on, thing] | |
end | |
end | |
multiple = Object.new | |
expect(multiple).to transition_from(:standing).to(:walking).on_event(:walk).on(:move) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment