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
module ViewResourceMacros | |
def has_resource(name, &block) | |
before do | |
# Creates the resource | |
@resource ||= yield | |
# Assign to the symbol we wanted, so it's available in the view | |
assign(name, @resource) | |
# Assigns to @name so that we can use that in our assertions | |
instance_variable_set("@#{name}", @resource) |