forked from notahat/not_a_mock
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaned up the stubber by adding a stubmethod object to hold all the …
…data about the stub, including the block to execute
- Loading branch information
Derick Bailey
committed
Oct 25, 2009
1 parent
d7cd451
commit c55cd49
Showing
5 changed files
with
45 additions
and
43 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,22 @@ | ||
require 'singleton' | ||
|
||
module NotAMock | ||
class StubMethod | ||
attr_accessor :yield_values, :return_block | ||
|
||
def initialize(&block) | ||
@block = block | ||
@yield_values = [] | ||
end | ||
|
||
def yields(*args) | ||
@yield_values = args | ||
end | ||
|
||
def execute_return_block(*args) | ||
return_value = nil | ||
(return_value = @block.call(*args)) unless @block.nil? | ||
return_value | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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