Created
January 5, 2012 12:48
-
-
Save petejohanson/1565119 to your computer and use it in GitHub Desktop.
Riot helpers don't memoize?
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
require 'teststrap' | |
context 'an array'do | |
topic { Array.new } | |
# Works as expected | |
context 'when adding an object using manual memoize' do | |
helper(my_object) { @my_object ||= Object.new } | |
hookup { topic << my_object } | |
asserts(:first).equals my_object | |
end | |
# Fails | |
context 'when adding via basic helper' do | |
helper(my_object) { Object.new } | |
hookup { topic << my_object } | |
asserts(:first).equals my_object | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment