module ThoughtBot::Shoulda::Controller::Helpers

def instantiate_variables_from_assigns(*names, &blk)

def instantiate_variables_from_assigns(*names, &blk)
  old = {}
  names = (@response.template.assigns.keys - SPECIAL_INSTANCE_VARIABLES) if names.empty?
  names.each do |name|
    old[name] = instance_variable_get("@#{name}")
    instance_variable_set("@#{name}", assigns(name.to_sym))
  end
  blk.call
  names.each do |name|
    instance_variable_set("@#{name}", old[name])
  end
end