Sha256: 34c7961647da3fb4cb586d3e86a13ac16874593661c33c41868a7fa281fd1cbb

Contents?: true

Size: 704 Bytes

Versions: 43

Compression:

Stored size: 704 Bytes

Contents

require 'test_helper'

class CassandraObject::Types::StringTypeTest < CassandraObject::Types::TestCase
  test 'encode' do
    assert_equal 'abc', coder.encode('abc')

    assert_raise ArgumentError do
      coder.encode(123)
    end
  end

  test 'wrap' do
    assert_equal(
      '123'.force_encoding('UTF-8').encoding,
      coder.wrap(nil, nil, '123'.force_encoding('ASCII-8BIT')).encoding
    )
  end

  test 'wrap when frozen' do
    assert_equal(
      '123'.force_encoding('UTF-8').encoding,
      coder.wrap(nil, nil, '123'.force_encoding('ASCII-8BIT').freeze).encoding
    )
  end

  test 'wrap when not a string' do
    assert_equal(
      "123",
      coder.wrap(nil, nil, 123)
    )
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
gotime-cassandra_object-4.5.1 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.5.0 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.4.5 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.4.4 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.4.3 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.4.0 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.3.2 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.3.1 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.3.0 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.2.2 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.2.0 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.1.0 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.0.2 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.0.1 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.0.0 test/unit/types/string_type_test.rb
gotime-cassandra_object-3.0.5 test/unit/types/string_type_test.rb
gotime-cassandra_object-3.0.4 test/unit/types/string_type_test.rb
gotime-cassandra_object-3.0.3 test/unit/types/string_type_test.rb
gotime-cassandra_object-3.0.2 test/unit/types/string_type_test.rb
gotime-cassandra_object-3.0.1 test/unit/types/string_type_test.rb