spec/lib/ratatouille/ratifier_spec.rb in ratatouille-1.3.2 vs spec/lib/ratatouille/ratifier_spec.rb in ratatouille-1.3.4
- old
+ new
@@ -7,9 +7,23 @@
it "should be valid on instantiation of new object" do
e = RatifierTest.new({})
e.should be_valid
end
+ it "should not progress into block if :is_a validation fails" do
+ f = false
+ RatifierTest.new({}, :is_a => String) { f = true }
+ f.should be_false
+
+ g = false
+ RatifierTest.new({}, :is_a => Hash) { g = true }
+ g.should be_true
+
+ h = false
+ RatifierTest.new({}) { h = true }
+ h.should be_true
+ end
+
it "errors should contain one key within block of new instance" do
x = {}
e = RatifierTest.new({}){ x = @errors }
x.keys.size.should == 1
x.keys.should == ['/']