Sha256: eb7cec986628077061598621e449e2bde9f33c552cf9a6d2b12039d9e8199be1

Contents?: true

Size: 831 Bytes

Versions: 58

Compression:

Stored size: 831 Bytes

Contents

require 'test_helper'

class IndifferentHashTest < ActiveSupport::TestCase
  setup do
    @hash = Devise::IndifferentHash.new
  end

  test "it overwrites getter and setter" do
    @hash[:foo] = "bar"
    assert_equal "bar", @hash["foo"]
    assert_equal "bar", @hash[:foo]

    @hash["foo"] = "baz"
    assert_equal "baz", @hash["foo"]
    assert_equal "baz", @hash[:foo]
  end

  test "it overwrites update" do
    @hash.update :foo => "bar"
    assert_equal "bar", @hash["foo"]
    assert_equal "bar", @hash[:foo]

    @hash.update "foo" => "baz"
    assert_equal "baz", @hash["foo"]
    assert_equal "baz", @hash[:foo]
  end

  test "it returns a Hash on to_hash" do
    @hash[:foo] = "bar"
    assert_equal Hash["foo", "bar"], @hash.to_hash
    assert_kind_of Hash, @hash.to_hash
  end
end if defined?(Devise::IndifferentHash)

Version data entries

58 entries across 52 versions & 7 rubygems

Version Path
devise-2.0.6 test/indifferent_hash.rb
devise-2.1.4 test/indifferent_hash.rb
devise_sociable-0.1.0 vendor/bundle/gems/devise-1.2.1/test/indifferent_hash.rb
devise_sociable-0.1.0 vendor/bundle/gems/devise-1.5.4/test/indifferent_hash.rb
devise-2.1.3 test/indifferent_hash.rb
devise-2.0.5 test/indifferent_hash.rb
devise-1.5.4 test/indifferent_hash.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/test/indifferent_hash.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/devise-2.0.4/test/indifferent_hash.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/test/indifferent_hash.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/devise-2.0.4/test/indifferent_hash.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/test/indifferent_hash.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/devise-2.0.4/test/indifferent_hash.rb
devise-2.1.2 test/indifferent_hash.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/devise-2.0.4/test/indifferent_hash.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/test/indifferent_hash.rb
rmello-devise-2.1.0.2 test/indifferent_hash.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/devise-2.0.4/test/indifferent_hash.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/test/indifferent_hash.rb
devise-2.1.0 test/indifferent_hash.rb