diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-09-24 18:55:18 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-12-04 09:32:40 +0000 |
commit | 4ac3189ac35e7c4d59d0bff7ec1a82c36d9d6a28 (patch) | |
tree | 9326cfe07e428e42a9d1d0ba319b06c793f6c0cf | |
parent | 0028d63dce4db36fcb0877770c67131b652d3cfd (diff) |
Create a placeholder salutation for a batch request template.
-rw-r--r-- | app/models/outgoing_message.rb | 6 | ||||
-rw-r--r-- | spec/models/outgoing_message_spec.rb | 14 |
2 files changed, 17 insertions, 3 deletions
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index 6efc1d2ba..8d8322b17 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -71,7 +71,11 @@ class OutgoingMessage < ActiveRecord::Base if self.message_type == 'followup' && !self.incoming_message_followup.nil? && !self.incoming_message_followup.safe_mail_from.nil? && self.incoming_message_followup.valid_to_reply_to? ret = ret + OutgoingMailer.name_for_followup(self.info_request, self.incoming_message_followup) else - ret = ret + self.info_request.public_body.name + if self.info_request.is_batch_request_template? + ret = ret + _("[Authority name]") + else + ret = ret + self.info_request.public_body.name + end end salutation = _("Dear {{public_body_name}},", :public_body_name => ret) end diff --git a/spec/models/outgoing_message_spec.rb b/spec/models/outgoing_message_spec.rb index bb270ca16..a3e2d1c68 100644 --- a/spec/models/outgoing_message_spec.rb +++ b/spec/models/outgoing_message_spec.rb @@ -57,7 +57,8 @@ describe OutgoingMessage, " when making an outgoing message" do info_request = mock_model(InfoRequest, :public_body => public_body, :url_title => 'a_test_title', :title => 'A test title', - :apply_censor_rules_to_text! => nil) + :apply_censor_rules_to_text! => nil, + :is_batch_request_template? => false) outgoing_message = OutgoingMessage.new({ :status => 'ready', :message_type => 'followup', @@ -68,6 +69,15 @@ describe OutgoingMessage, " when making an outgoing message" do outgoing_message.body.should include(expected_text) end + context "when associated with a batch template request" do + + it 'should produce a salutation with a placeholder' do + @om.info_request.is_batch_request_template = true + @om.get_salutation.should == 'Dear [Authority name],' + end + end + + describe 'when asked if a user can view it' do before do @@ -166,7 +176,7 @@ describe OutgoingMessage, " when censoring data" do end end -describe OutgoingMessage, "when validating the format of the message body", :focus => true do +describe OutgoingMessage, "when validating the format of the message body" do it 'should handle a salutation with a bracket in it' do outgoing_message = FactoryGirl.build(:initial_request) |