Sha256: ea141baa1b37ab02f86ce0198172ee8bcb138c3e29c3a4b6b6c066d9962028b8

Contents?: true

Size: 744 Bytes

Versions: 3

Compression:

Stored size: 744 Bytes

Contents

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

class SdbBooleanTest < Test::Unit::TestCase

  include DeadSimpleDb

  should "cast correctly a true/false string" do
    boolean = SdbBoolean.new('true')
    assert_equal true, boolean.casted
    boolean = SdbBoolean.new('false')
    assert_equal false, boolean.casted
  end

  should "be identical if provided a boolean" do
    boolean = SdbBoolean.new(true)
    assert_equal true, boolean.casted
    boolean = SdbBoolean.new(false)
    assert_equal false, boolean.casted
  end

  should "be a string when converted to string" do
    boolean = SdbBoolean.new('yeah')
    assert_equal 'TRUE', boolean.to_s
    boolean = SdbBoolean.new('false')
    assert_equal 'FALSE', boolean.to_s
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

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