From 99fb6b483cca96bd55a64bc1137e1070e01b32ba Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 7 Jan 2015 13:40:40 +0000 Subject: Use a partial to render request sent message --- spec/controllers/request_controller_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/controllers/request_controller_spec.rb') diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 2d3ccfa63..dc28f6dab 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -1073,6 +1073,16 @@ describe RequestController, "when creating a new request" do response.redirect_url.should =~ /request\/why_is_your_quango_called_gerald\/new$/ end + it "sets the request_sent flash to true if successful" do + session[:user_id] = @user.id + post :new, :info_request => { :public_body_id => @body.id, + :title => "Why is your quango called Geraldine?", :tag_string => "" }, + :outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." }, + :submitted_new_request => 1, :preview => 0 + + expect(flash[:request_sent]).to be_true + end + it "should give an error if the same request is submitted twice" do session[:user_id] = @user.id -- cgit v1.2.3 From ebf549a966a9c559bfa76b66f4ab86a75c2c1c92 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 9 Jan 2015 12:02:53 +0000 Subject: Use a partial to render batch sent message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dropped the law_used_full interpolation: So I think there are two significant bits of context here. One is that the law_used_full attribute is derived from law_used, which in turn is set on InfoRequest initialisation based on the tags applied to the public body. So different requests in a batch could have different values for law_used_full - some of them might be to bodies that only accept environmental information requests. So using the value from the batch template is not really a good proxy for the whole collection. The second is that, in any case, the distinction between the two types of request is a UK-specific feature which should be moved to the UK theme (#2085). Given these two factors, I think the cleanest thing might be to drop law_used_full from this descriptive text, and just have it say "Your requests will be sent shortly", without specifying what law will be used. – Louise Crow (@crowbot) --- spec/controllers/request_controller_spec.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'spec/controllers/request_controller_spec.rb') diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index dc28f6dab..aeb27f918 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -2564,10 +2564,9 @@ describe RequestController, "#new_batch" do assigns[:existing_batch].should_not be_nil end - it 'should display a success notice' do + it 'sets the batch_sent flash to true' do make_request - notice_text = "

Your Freedom of Information requests will be sent shortly!" - flash[:notice].should match notice_text + expect(flash[:batch_sent]).to be_true end end -- cgit v1.2.3