Sha256: 81f86ba7d70d8a4d2207f84de75b6350c8eb02d4a5f01823ef6994bbfee66035

Contents?: true

Size: 456 Bytes

Versions: 10

Compression:

Stored size: 456 Bytes

Contents

module DeviseHelpers
  # Execute the block setting the given values and restoring old values after
  # the block is 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
    yield
  ensure
    old_values.each do |key, value|
      object.send :"#{key}=", value
    end
  end
end

RSpec::configure { |c| c.include DeviseHelpers }

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
devise-multi-radius-authenticatable-0.3.0 spec/support/devise_helpers.rb
devise-multi-radius-authenticatable-0.2.0 spec/support/devise_helpers.rb
devise-multi-radius-authenticatable-0.1.2 spec/support/devise_helpers.rb
devise-multi-radius-authenticatable-0.1.1 spec/support/devise_helpers.rb
devise-radius-authenticatable-0.0.6 spec/support/devise_helpers.rb
devise-radius-authenticatable-0.0.5 spec/support/devise_helpers.rb
devise-radius-authenticatable-0.0.4 spec/support/devise_helpers.rb
devise-radius-authenticatable-0.0.3 spec/support/devise_helpers.rb
devise-radius-authenticatable-0.0.2 spec/support/devise_helpers.rb
devise-radius-authenticatable-0.0.1 spec/support/devise_helpers.rb