Sha256: b04ff033c17703a443f18672f9b8eb608c0c685e1144e5c1868e8fb9e5d0b177
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
require File.dirname(__FILE__) + '/test_helper' class AttributeTest < Test::Unit::TestCase include DeadSimpleDb should "set the name" do attribute = Attribute.new(:number, 'Integer') assert_equal :number, attribute.name end should "should instantiate the correct class" do SdbInteger.expects(:new).with('10', :decimals => 10) attribute = Attribute.new(:number, 'Integer', :decimals => 10) attribute.set('10') end should "should instantiate a null when a null value is passed" do null_value = SdbNull::NULL_VALUES.first SdbNull.expects(:new).with(null_value, :decimals => 10) attribute = Attribute.new(:number, 'Integer', :decimals => 10) attribute.set(null_value) end should "should call to_s on its value" do integer_mock = Mocha::Mock.new SdbInteger.expects(:new).with('10', :decimals => 10).returns(integer_mock) attribute = Attribute.new(:number, 'Integer', :decimals => 10) attribute.set('10') integer_mock.expects(:to_s) attribute.to_s end should "should cast to return value" do integer_mock = Mocha::Mock.new SdbInteger.expects(:new).with('10', :decimals => 10).returns(integer_mock) attribute = Attribute.new(:number, 'Integer', :decimals => 10) attribute.set('10') integer_mock.expects(:casted) attribute.value end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hungryblank-dead_simple_db-0.0.1 | test/attribute_test.rb |
hungryblank-dead_simple_db-0.0.2 | test/attribute_test.rb |
hungryblank-dead_simple_db-0.0.3 | test/attribute_test.rb |