Sha256: a63f6487048298414845e17e05abf8e843d5368228eee8392c50a1733cc76d67

Contents?: true

Size: 705 Bytes

Versions: 27

Compression:

Stored size: 705 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

27 entries across 27 versions & 2 rubygems

Version Path
gotime-cassandra_object-4.12.2 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.12.1 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.12.0 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.11.6 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.11.5 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.11.4 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.11.3 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.11.2 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.11.1 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.11.0 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.10.5 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.10.4 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.10.3 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.10.2 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.10.1 test/unit/types/string_type_test.rb
cassandra_object_rails-0.0.1 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.10.0 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.9.2 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.9.1 test/unit/types/string_type_test.rb
gotime-cassandra_object-4.9.0 test/unit/types/string_type_test.rb