spec/attributes_spec.rb in simple_model-1.2.17 vs spec/attributes_spec.rb in simple_model-1.2.18
- old
+ new
@@ -65,14 +65,14 @@
end
context '#new_with_store'do
it "should use the provided object as the attribute store" do
my_store = {:test1 => 1,:test2 => 2}
- new = TestInit.new_with_store(my_store)
- new.test1 = 3
- new.test1.should eql(3)
- my_store[:test1].should eql(new.test1)
+ nw = TestInit.new_with_store(my_store)
+ nw.test1 = 3
+ nw.test1.should eql(3)
+ my_store[:test1].should eql(nw.test1)
end
end
context "AVAILABLE_ATTRIBUTE_METHODS" do
SimpleModel::Attributes::ClassMethods::AVAILABLE_ATTRIBUTE_METHODS.each do |m,options|
@@ -249,15 +249,13 @@
NewerBase.attribute_defined?(:bar).should eql(true)
n = NewerBase.new
n.respond_to?(:bar_will_change!).should eql(true)
end
- it "should defaults that were not initialized should work from parent class" do
+ it "should set defaults that were not initialized should work from parent class" do
n = NewerBase.new
- n.some.should eql(Date.today)
- n.some = "2012-12-01"
- n.some.should be_a(Date)
- n.thing.should eql(Date.today)
+ n.some.should eql(n.send(:fetch_date))
+ n.thing.should eql(n.send(:fetch_date))
end
it "should allow redefining methods in child classes" do
n = NewerBase.new
n.str = '1'