Sha256: e25e0990bae69e0d77311c2ffa20a1fdca32ca1213a9f4d1a9924278081f5410

Contents?: true

Size: 692 Bytes

Versions: 10

Compression:

Stored size: 692 Bytes

Contents

require "test_helper"

class HashTest < ActiveSupport::TestCase

  should "verify Hash#compact" do
    hash = { "a" => "", "b" => nil, "c" => "hello" }
    hash_compacted = { "c" => "hello" }
    assert_equal hash_compacted, hash.compact
  end

  context "cleanup" do

    should "work" do
      whitelist = %w(controller action id input layout resource resource_id resource_action selected back_to )
      whitelist.each do |w|
        expected = { w => w }
        assert_equal expected, expected.dup.cleanup
      end
    end

    should "reject unwanted stuff" do
      hash = {"attribute" => "dragonfly"}
      expected = {}
      assert_equal expected, hash.cleanup
    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
typus-3.0.11 test/lib/support/hash_test.rb
typus-3.0.11.rc5 test/lib/support/hash_test.rb
typus-3.0.11.rc4 test/lib/support/hash_test.rb
typus-3.0.11.rc3 test/lib/support/hash_test.rb
typus-3.0.11.rc2 test/lib/support/hash_test.rb
typus-3.0.11.rc1 test/lib/support/hash_test.rb
typus-3.0.10 test/lib/support/hash_test.rb
typus-3.0.9 test/lib/support/hash_test.rb
typus-3.0.8 test/lib/support/hash_test.rb
typus-3.0.7 test/lib/support/hash_test.rb