Sha256: 52c4e69da46abee6130574752c095b3db8248374241e8b0049387dea3208faea

Contents?: true

Size: 576 Bytes

Versions: 3

Compression:

Stored size: 576 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper'

class SdbNullTest < Test::Unit::TestCase

  include DeadSimpleDb

  should "cast a string to nil" do
    null = SdbNull.new('')
    assert_equal nil, null.casted
  end

  should "be identical if provided a nil" do
    null = SdbNull.new(nil)
    assert_equal nil, null.casted
  end

  should "be a NULL when converted to string" do
    null = SdbNull.new('')
    assert_equal 'NULL', null.to_s
  end

  should "raise an exception if provided a non null string" do
    assert_raise(RuntimeError) { SdbNull.new('4') }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hungryblank-dead_simple_db-0.0.1 test/sdb_null_test.rb
hungryblank-dead_simple_db-0.0.2 test/sdb_null_test.rb
hungryblank-dead_simple_db-0.0.3 test/sdb_null_test.rb