Sha256: aff86e7787c602cd60b5daadc3cdfd71dc52a6e270634ff78b8c2e6cf30c2e12

Contents?: true

Size: 617 Bytes

Versions: 13

Compression:

Stored size: 617 Bytes

Contents

require 'test_helper'

class Superstore::Types::ArrayTypeTest < Superstore::Types::TestCase
  if Superstore::Base.adapter.class.name == 'Superstore::Adapters::CassandraAdapter'
    test 'encode' do
      assert_equal ['1', '2'].to_json, type.encode(['1', '2'])

      assert_raise ArgumentError do
        type.encode('wtf')
      end
    end

    test 'decode' do
      assert_equal ['1', '2'], type.decode(['1', '2'].to_json)
      assert_equal nil, type.decode(nil)
      assert_equal nil, type.decode('')
    end
  end

  test 'typecast' do
    assert_equal ['x', 'y'], type.typecast(['x', 'y'].to_set)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
superstore-2.4.4 test/unit/types/array_type_test.rb
superstore-2.4.3 test/unit/types/array_type_test.rb
superstore-2.4.2 test/unit/types/array_type_test.rb
superstore-2.4.1 test/unit/types/array_type_test.rb
superstore-2.4.0 test/unit/types/array_type_test.rb
superstore-2.3.0 test/unit/types/array_type_test.rb
superstore-2.2.0 test/unit/types/array_type_test.rb
superstore-2.1.3 test/unit/types/array_type_test.rb
superstore-2.1.2 test/unit/types/array_type_test.rb
superstore-2.1.1 test/unit/types/array_type_test.rb
superstore-2.1.0 test/unit/types/array_type_test.rb
superstore-2.0.1 test/unit/types/array_type_test.rb
superstore-2.0.0 test/unit/types/array_type_test.rb