spec/model_spec.rb in blendris-0.5 vs spec/model_spec.rb in blendris-0.6
- old
+ new
@@ -20,12 +20,15 @@
@onion.category = @vegetable
@onion.category.name.should == "vegetable"
end
it "should not allow its key values to be changed" do
- lambda { @onion.name = "asdf" }.should raise_exception(BlendrisCannotSetKeyValue)
- lambda { @onion.description = "asdf" }.should_not raise_exception
+ @onion.should respond_to :name
+ @onion.should_not respond_to :name=
+
+ @onion.should respond_to :description
+ @onion.should respond_to :description=
end
it "should have a valid reference set" do
@fruit.foods.count.should == 0
@@ -221,8 +224,12 @@
lambda { o.integer = 123 }.should raise_exception TestEx
lambda { o.set = [1,2,3] }.should raise_exception TestEx
lambda { o.list = [1,5,8] }.should raise_exception TestEx
lambda { o.ref = o }.should raise_exception TestEx
lambda { o.refs << o }.should raise_exception TestEx
+ end
+
+ it "should be ok when you have sets and lists in the key" do
+ lambda { WeirdKeyModel.create([ "ok" ], [ "weird" ]) }.should raise_exception(ArgumentError)
end
end