From f0780e6ba398f0febac537a15ada6c25d0bd1f5e Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Wed, 15 Jun 2011 06:29:34 +0100 Subject: Test that PublicBody.first_letter is correctly set on save --- spec/models/public_body_spec.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'spec/models') 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 -- cgit v1.2.3