aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-12-18 19:39:35 +0000
committerLouise Crow <louise.crow@gmail.com>2014-01-13 12:36:42 +0000
commitb5e8bd1ae1cca585e65e9d7401a762ae7e32b89f (patch)
tree63ab12efe9b650599cb40c87dcdf6369e480bea9 /spec/models
parent75ea3f8298da5943c5b762dc4304b85769b391e1 (diff)
Populate admin public body forms based on a change request.
Also add editable text for an email to be sent to the person requesting the change.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/public_body_change_request_spec.rb29
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
+