Sha256: c957cb7a41e2c1b374d8357880992df56cbe95f06a2f4dddba7a1209cde2b73b

Contents?: true

Size: 730 Bytes

Versions: 13

Compression:

Stored size: 730 Bytes

Contents

require 'test_helper'

class Superstore::Types::BooleanTypeTest < Superstore::Types::TestCase
  if Superstore::Base.adapter.class.name == 'Superstore::Adapters::CassandraAdapter'
    test 'encode' do
      assert_equal '1', type.encode(true)
      assert_equal '1', type.encode('true')
      assert_equal '1', type.encode('1')

      assert_equal '0', type.encode(false)
      assert_equal '0', type.encode('false')
      assert_equal '0', type.encode('0')
      assert_equal '0', type.encode('')

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

  test 'decode' do
    assert_equal true, type.decode('1')
    assert_equal false, type.decode('0')
    # assert_nil type.decode(nil)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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