spec/validations_spec.rb in asset_cloud-2.2.0 vs spec/validations_spec.rb in asset_cloud-2.2.1
- old
+ new
@@ -37,9 +37,19 @@
@cat.store.should == false
@cat.warnings.should == []
end
end
+ describe "#store!" do
+ it "should raise AssetNotFound with error message when validation fails" do
+ expect { @cat.store! }.to raise_error(AssetCloud::AssetNotSaved, "Validation failed: no cats allowed!")
+ end
+
+ it "should return true when validations pass" do
+ @dog.store!.should == true
+ end
+ end
+
describe "#valid?" do
it "should clear errors, run validations, and return validity" do
@cat.store
@cat.errors.should == ['no cats allowed!']
@cat.valid?.should == false