Sha256: 497a022ea8257a21636151f43e16e0c0c638f68dd3c44a0cc189825920cdea1d
Contents?: true
Size: 745 Bytes
Versions: 19
Compression:
Stored size: 745 Bytes
Contents
# Helpers used for devise testing. # # Execute the block setting the given values in # +new_values+ and restoring the old values # after the block was executed. # def swap(object, new_values) old_values = {} new_values.each do |key, value| old_values[key] = object.send key object.send(:"#{key}=", value) end clear_cached_variables(new_values) yield ensure clear_cached_variables(new_values) old_values.each do |key, value| object.send(:"#{key}=", value) end end def clear_cached_variables(options) if options.key?(:case_insensitive_keys) || options.key?(:strip_whitespace_keys) Devise.mappings.each do |_, mapping| mapping.to.instance_variable_set(:@devise_parameter_filter, nil) end end end
Version data entries
19 entries across 19 versions & 1 rubygems