Sha256: c0d425a6caaa520f4c8488384eb9d6a4120eb99abf9ac788a196810c6c280940

Contents?: true

Size: 699 Bytes

Versions: 18

Compression:

Stored size: 699 Bytes

Contents

require 'test_helper'

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

    assert_raise ArgumentError do
      coder.encode(123)
    end
  end

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

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

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
superstore-1.2.0 test/unit/types/string_type_test.rb
superstore-1.1.4 test/unit/types/string_type_test.rb
superstore-1.1.3 test/unit/types/string_type_test.rb
superstore-1.1.2 test/unit/types/string_type_test.rb
superstore-1.1.1 test/unit/types/string_type_test.rb
superstore-1.1.0 test/unit/types/string_type_test.rb
superstore-1.0.12 test/unit/types/string_type_test.rb
superstore-1.0.11 test/unit/types/string_type_test.rb
superstore-1.0.10 test/unit/types/string_type_test.rb
superstore-1.0.9 test/unit/types/string_type_test.rb
superstore-1.0.8 test/unit/types/string_type_test.rb
superstore-1.0.7 test/unit/types/string_type_test.rb
superstore-1.0.6 test/unit/types/string_type_test.rb
superstore-1.0.5 test/unit/types/string_type_test.rb
superstore-1.0.4 test/unit/types/string_type_test.rb
superstore-1.0.3 test/unit/types/string_type_test.rb
superstore-1.0.2 test/unit/types/string_type_test.rb
superstore-1.0.0 test/unit/types/string_type_test.rb