Sha256: f1493681696d5c54ba17308e317690c3c7017a1a032207be91842676c6e0fe6a

Contents?: true

Size: 660 Bytes

Versions: 31

Compression:

Stored size: 660 Bytes

Contents

require 'test_helper'

module Workarea
  class HashUpdateTest < TestCase
    def test_apply
      hash = { 'foo' => 'bar' }

      HashUpdate.new(adds: %w(key value)).apply(hash)
      assert_equal(%w(value), hash['key'])

      HashUpdate.new(updates: %w(foo baz)).apply(hash)
      assert_equal(%w(baz), hash['foo'])

      HashUpdate.new(removes: %w(foo)).apply(hash)
      refute_includes(hash.keys, 'foo')

      HashUpdate.new(adds: ['key', 'one, two ']).apply(hash)
      assert_equal(%w(one two), hash['key'])

      HashUpdate.new(updates: ['key', 'one,  two, three ']).apply(hash)
      assert_equal(%w(one two three), hash['key'])
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
workarea-core-3.5.9 test/services/workarea/hash_update_test.rb
workarea-core-3.4.31 test/services/workarea/hash_update_test.rb
workarea-core-3.5.8 test/services/workarea/hash_update_test.rb
workarea-core-3.4.30 test/services/workarea/hash_update_test.rb
workarea-core-3.5.7 test/services/workarea/hash_update_test.rb
workarea-core-3.4.29 test/services/workarea/hash_update_test.rb
workarea-core-3.5.6 test/services/workarea/hash_update_test.rb
workarea-core-3.4.28 test/services/workarea/hash_update_test.rb
workarea-core-3.5.5 test/services/workarea/hash_update_test.rb
workarea-core-3.4.27 test/services/workarea/hash_update_test.rb
workarea-core-3.5.4 test/services/workarea/hash_update_test.rb
workarea-core-3.4.26 test/services/workarea/hash_update_test.rb
workarea-core-3.5.3 test/services/workarea/hash_update_test.rb
workarea-core-3.4.25 test/services/workarea/hash_update_test.rb
workarea-core-3.5.2 test/services/workarea/hash_update_test.rb
workarea-core-3.4.24 test/services/workarea/hash_update_test.rb
workarea-core-3.5.1 test/services/workarea/hash_update_test.rb
workarea-core-3.4.23 test/services/workarea/hash_update_test.rb
workarea-core-3.4.22 test/services/workarea/hash_update_test.rb
workarea-core-3.5.0 test/services/workarea/hash_update_test.rb