Skip to content

Instantly share code, notes, and snippets.

@matthewd
Last active August 29, 2015 14:27
Show Gist options
  • Save matthewd/314493760560a5fdc7f1 to your computer and use it in GitHub Desktop.
Save matthewd/314493760560a5fdc7f1 to your computer and use it in GitHub Desktop.
diff --git a/spec/helpers/application_helper/toolbar_builder_spec.rb b/spec/helpers/application_helper/toolbar_builder_spec.rb
index 546ce2b..81ce5f3 100644
--- a/spec/helpers/application_helper/toolbar_builder_spec.rb
+++ b/spec/helpers/application_helper/toolbar_builder_spec.rb
@@ -3,11 +3,14 @@
describe ApplicationHelper do
before do
controller.send(:extend, ApplicationHelper)
- self.class.send(:include, ApplicationHelper)
end
def method_missing(sym, *args)
- b = _toolbar_builder
+ instance_variables.each do |ivar|
+ controller.instance_variable_set ivar, instance_variable_get(ivar)
+ end
+
+ b = controller._toolbar_builder
if b.respond_to?(sym, true)
b.send(sym, *args)
else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment