diff options
author | tony <tony> | 2009-03-22 14:27:52 +0000 |
---|---|---|
committer | tony <tony> | 2009-03-22 14:27:52 +0000 |
commit | f30f0846944bc99a83b2126abdfe367f5eccb2e9 (patch) | |
tree | dd1ecfe9f2b71e55ad593c92b2bf0d60e2ca9553 | |
parent | 49b77267e8d379cd11df95a9a0166f44c1a9a205 (diff) |
rspec provides a useful errors_on test
-rw-r--r-- | spec/models/public_body_spec.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb index b5b7a2c8c..20216cf59 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -5,17 +5,18 @@ describe PublicBody, " when saving" do @public_body = PublicBody.new end - it "should not save without setting some parameters" do - lambda { @public_body.save! }.should raise_error(ActiveRecord::RecordInvalid) + it "should not be valid without setting some parameters" do + @public_body.should_not be_valid end - it "should not save with misformatted request email" do + it "should not be valid with misformatted request email" do @public_body.name = "Testing Public Body" @public_body.short_name = "TPB" @public_body.request_email = "requestBOOlocalhost" @public_body.last_edit_editor = "*test*" @public_body.last_edit_comment = "This is a test" - lambda { @public_body.save! }.should raise_error(ActiveRecord::RecordInvalid) + @public_body.should_not be_valid + @public_body.should have(1).errors_on(:request_email) end it "should save" do |