spec/hashme/properties_spec.rb in hashme-0.2.4 vs spec/hashme/properties_spec.rb in hashme-0.2.5
- old
+ new
@@ -41,9 +41,17 @@
name = "Fred Flinstone"
expect(property).to receive(:build).with(obj, name).and_return(name)
obj.set_attribute(:name, name)
expect(obj[:name]).to eql(name)
end
+
+ it "should delete attribute set to nil" do
+ obj.name = "test"
+ expect(obj.name).to eql("test")
+ obj.name = nil
+ expect(obj.name).to be_nil
+ expect(obj.keys.map(&:to_s)).to_not include('name')
+ end
end
describe "#attribtues=" do
it "should set attributes on the model" do
expect(obj.name).to be_nil