diff options
author | Robin Houston <robin@lenny.robin> | 2011-06-15 06:29:34 +0100 |
---|---|---|
committer | Robin Houston <robin@lenny.robin> | 2011-06-15 06:29:34 +0100 |
commit | f0780e6ba398f0febac537a15ada6c25d0bd1f5e (patch) | |
tree | 6b3933e06a3eff6901798e207b114d71ab2f0904 | |
parent | fb5f1b3f3834dd696ae4aa6cc906244b6c23da78 (diff) |
Test that PublicBody.first_letter is correctly set on save
-rw-r--r-- | spec/models/public_body_spec.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb index acfe005e8..5bbf03d27 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -133,7 +133,7 @@ end describe PublicBody, " when saving" do before do - @public_body = PublicBody.new + @public_body = PublicBody.new end it "should not be valid without setting some parameters" do @@ -158,6 +158,18 @@ describe PublicBody, " when saving" do @public_body.last_edit_comment = "This is a test" @public_body.save! end + + it "should update first_letter" do + @public_body.name = "Testing Public Body" + @public_body.short_name = "TPB" + @public_body.request_email = "request@localhost" + @public_body.last_edit_editor = "*test*" + @public_body.last_edit_comment = "This is a test" + + @public_body.first_letter.should be_nil + @public_body.save! + @public_body.first_letter.should == 'T' + end end describe PublicBody, "when searching" do |