Skip to content

Instantly share code, notes, and snippets.

@petejohanson
Created January 5, 2012 12:48
Show Gist options
  • Save petejohanson/1565119 to your computer and use it in GitHub Desktop.
Save petejohanson/1565119 to your computer and use it in GitHub Desktop.
Riot helpers don't memoize?
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