aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-09-24 19:23:12 +0100
committerLouise Crow <louise.crow@gmail.com>2013-12-04 09:32:40 +0000
commitacb186466b20172a6804f86f8a082f148ec50fc6 (patch)
treee45d2df4be5a67f895f9ad557b268cd7d6bd09de /spec/controllers
parentbc080e7e8bcab015cedd1c17208490239f97fb77 (diff)
Create template and outgoing message
Add validation, preview as in single request creation. Add comments noting further work to be done in this action.
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/request_controller_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 2e928eb3b..d92eb6aa2 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -2533,6 +2533,35 @@ describe RequestController, "#new_batch", :focus => true do
response.should render_template('request/new')
end
+
+ it "should render 'preview' when given a good title and body" do
+
+ post :new_batch, { :info_request => { :title => "What does it all mean?",
+ :tag_string => "" },
+ :outgoing_message => { :body => "This is a silly letter." },
+ :submitted_new_request => 1,
+ :preview => 1 }, { :user_id => @user.id }
+ response.should render_template('preview')
+ end
+
+ it "should give an error and render 'new' template when a summary isn't given" do
+ post :new_batch, { :info_request => { :tag_string => "" },
+ :outgoing_message => { :body => "This is a silly letter." },
+ :submitted_new_request => 1,
+ :preview => 1 }, { :user_id => @user.id }
+ assigns[:info_request].errors[:title].should == ['Please enter a summary of your request']
+ response.should render_template('new')
+ end
+
+ it "should allow re-editing of a request" do
+ post :new_batch, { :info_request => { :tag_string => "" },
+ :outgoing_message => { :body => "This is a silly letter." },
+ :submitted_new_request => 1,
+ :preview => 0,
+ :reedit => 1}, { :user_id => @user.id }
+ response.should render_template('new')
+ end
+
end
context "when the current user can't make batch requests" do