Created
December 17, 2010 06:52
-
-
Save rafadc/744591 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
def test_when_success_with_nothing_to_chain | |
myObject = mock() | |
myObject.expects(:method).once.returns(nil) | |
myObject.expects(:method_to_be_called).once | |
When.success{myObject.method}.then_call{myObject.method_to_be_called}.as_a_chain | |
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
def test_that_parameter_is_chained_when_as_a_chain_is_called | |
parameter = 'Highly difficult to calculate value' | |
myObject = mock() | |
myObject.expects(:method).once.returns(parameter) | |
myObject.expects(:method_to_be_called).with(parameter).once | |
When.success{myObject.method}.then_call{|x| myObject.method_to_be_called(x)}.as_a_chain | |
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
def test_overload_of_that | |
parameter = 'Highly difficult to calculate value' | |
myObject = mock() | |
myObject.expects(:method).once.returns(parameter) | |
myObject.expects(:method_to_be_called).with(parameter).once | |
When.success{myObject.method}.then_call(:as_a_chain){|x| myObject.method_to_be_called(x)} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment