Created
January 9, 2010 10:50
-
-
Save reactormonk/272847 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
setup :method, "#member" do | |
@method = :member | |
end | |
setup :method, "#collection" do | |
@method = :collection | |
end | |
setup :stem, "stem" do | |
@stem = Stem.allocate | |
@params = {foo: :bar, type: @method} | |
mock(@stem).leaf(@params) | |
end | |
assert ":method" do | |
@stem.send(@method, @params) | |
end | |
# Methods to test: | |
# Creates a new leaf with type member. See Leaf. | |
def member(params) | |
leaf(params.merge({type: :member})) | |
end | |
# Creates a new leaf with type collection. See Leaf. | |
def collection(params) | |
leaf(params.merge({type: :collection})) | |
end | |
# Outcome: | |
extended leafs (1 test) | |
Error #member | |
member({:foo=>:bar, :type=>:member}) | |
Called 0 times. | |
Expected 1 times. | |
Error #collection | |
member({:foo=>:bar, :type=>:collection}) | |
Called 0 times. | |
Expected 1 times. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment