spec/attributes_spec.rb in simple_model-0.2.6 vs spec/attributes_spec.rb in simple_model-1.0.0

- old
+ new

@@ -22,11 +22,11 @@ @init.attributes[:test2].should eql("2") end end describe SimpleModel::Attributes, 'define_reader_with_options' do - before(:all) do + before(:each) do class TestDefault include SimpleModel::Attributes attr_accessor :test define_reader_with_options :test, :default => "test" end @@ -39,9 +39,26 @@ it "should not intefer with setting" do default = TestDefault.new default.test = "New" default.test.should eql("New") end + + context 'default value is a symbol' do + it "should call the method it describes" do + class TestDefault + include SimpleModel::Attributes + attr_accessor :test + define_reader_with_options :test, :default => :default_value + def default_value + "test" + end + end + + default = TestDefault.new + default.test.should eql("test") + end + end + end describe SimpleModel::Attributes, 'has_booleans' do before(:all) do class TestBoolean