diff options
Diffstat (limited to 'spec/models/public_body_change_request_spec.rb')
-rw-r--r-- | spec/models/public_body_change_request_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/models/public_body_change_request_spec.rb b/spec/models/public_body_change_request_spec.rb index 653a218e3..0c4cea67b 100644 --- a/spec/models/public_body_change_request_spec.rb +++ b/spec/models/public_body_change_request_spec.rb @@ -108,3 +108,32 @@ describe PublicBodyChangeRequest, 'get_public_body_name' do end +describe PublicBodyChangeRequest, 'when creating a comment for the associated public body' do + + it 'should include requesting user, source_url and notes' do + change_request = PublicBodyChangeRequest.new(:user_name => 'Test User', + :user_email => 'test@example.com', + :source_url => 'http://www.example.com', + :notes => 'Some notes') + expected = "Requested by: Test User (test@example.com)\nSource URL: http://www.example.com\nNotes: Some notes" + change_request.comment_for_public_body.should == expected + end + +end + +describe PublicBodyChangeRequest, 'when creating a default subject for a response email' do + + it 'should create an appropriate subject for a request to add a body' do + change_request = PublicBodyChangeRequest.new(:public_body_name => 'Test Body') + change_request.default_response_subject.should == 'Your request to add Test Body to Alaveteli' + end + + it 'should create an appropriate subject for a request to update an email address' do + public_body = FactoryGirl.build(:public_body) + change_request = PublicBodyChangeRequest.new(:public_body => public_body) + change_request.default_response_subject.should == "Your request to update #{public_body.name} on Alaveteli" + + end + +end + |