Sha256: b109ed3621e3be97731963ceba4a95fdd1a618ebc63f4d7226d133994ffe3725

Contents?: true

Size: 693 Bytes

Versions: 13

Compression:

Stored size: 693 Bytes

Contents

require 'test_helper'

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

    assert_raise ArgumentError do
      type.encode(123)
    end
  end

  test 'encode as utf' do
    assert_equal(
      '123'.force_encoding('UTF-8').encoding,
      type.encode('123'.force_encoding('ASCII-8BIT')).encoding
    )
  end

  test 'encode frozen as utf' do
    assert_equal(
      '123'.force_encoding('UTF-8').encoding,
      type.encode('123'.force_encoding('ASCII-8BIT').freeze).encoding
    )
  end

  test 'typecast' do
    assert_equal '123', type.typecast(123)
    assert_equal '123', type.typecast('123')
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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