lib/stache/mustache/handler.rb in stache-1.0.2 vs lib/stache/mustache/handler.rb in stache-1.0.3
- old
+ new
@@ -50,9 +50,14 @@
variables.each do |name|
mustache.instance_variable_set(name, controller.instance_variable_get(name))
end
+ # Add view instance variables also so RSpec view spec assigns will work
+ (instance_variable_names - variables).each do |name|
+ mustache.instance_variable_set(name, instance_variable_get(name))
+ end
+
# Declaring an +attr_reader+ for each instance variable in the
# Stache::Mustache::View subclass makes them available to your templates.
mustache.class.class_eval do
attr_reader *variables.map { |name| name.sub(/^@/, '').to_sym }
end