Skip to content

Commit

Permalink
Merge branch 'feature/email-subject-cleanup' into rails-3-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
crowbot committed Oct 7, 2013
2 parents 6841ed7 + b764f12 commit 8fef5df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 2 additions & 8 deletions app/models/info_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,9 @@ def incoming_name_and_email

# Subject lines for emails about the request
def email_subject_request
# XXX pull out this general_register_office specialisation
# into some sort of separate jurisdiction dependent file
if self.public_body.url_name == 'general_register_office'
# without GQ in the subject, you just get an auto response
_('{{law_used_full}} request GQ - {{title}}',:law_used_full=>self.law_used_full,:title=>self.title.html_safe)
else
_('{{law_used_full}} request - {{title}}',:law_used_full=>self.law_used_full,:title=>self.title.html_safe)
end
_('{{law_used_full}} request - {{title}}',:law_used_full=>self.law_used_full,:title=>self.title.html_safe)
end

def email_subject_followup(incoming_message = nil)
if incoming_message.nil? || !incoming_message.valid_to_reply_to? || !incoming_message.subject
'Re: ' + self.email_subject_request
Expand Down
10 changes: 10 additions & 0 deletions spec/models/info_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,16 @@
end
end

describe 'when working out a subject for request emails' do

it 'should create a standard request subject' do
info_request = FactoryGirl.build(:info_request)
expected_text = "Freedom of Information request - #{info_request.title}"
info_request.email_subject_request.should == expected_text
end

end

describe 'when working out a subject for a followup emails' do

it "should not be confused by an nil subject in the incoming message" do
Expand Down

0 comments on commit 8fef5df

Please sign in to comment.