From 5ad84d3ab83f4a7cb22fe69bbf5d6534683682af Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Mon, 25 Jul 2011 13:25:46 +0100 Subject: Remove redundant test (this change should be with commit dd58cd35e51c1b98228aae1aa930629e84b6a905) --- spec/controllers/request_controller_spec.rb | 14 -------------- 1 file changed, 14 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 8232a7398..9d91bf8c2 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -376,20 +376,6 @@ describe RequestController, "when creating a new request" do response.should render_template('new') end - it "should give an error if the same request is submitted twice with extra whitespace in the body" do - # This only works for PostgreSQL databases which have regexp_replace - - # see model method InfoRequest.find_by_existing_request for more info - if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" - session[:user_id] = @user.id - - post :new, :info_request => { :public_body_id => info_requests(:fancy_dog_request).public_body_id, - :title => info_requests(:fancy_dog_request).title }, - :outgoing_message => { :body => "\n" + info_requests(:fancy_dog_request).outgoing_messages[0].body + " "}, - :submitted_new_request => 1, :preview => 0, :mouse_house => 1 - response.should render_template('new') - end - end - it "should let you submit another request with the same title" do session[:user_id] = @user.id -- cgit v1.2.3 From 6e57ba619e11ee76a29eda12e7cfef1f9aefba8e Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Wed, 10 Aug 2011 16:19:48 +0100 Subject: Fix up missing fixtures (causing failures dependent on order the tests were funr). Also tidy up raw_email setup code to match everywhere. --- spec/controllers/request_controller_spec.rb | 12 +++++++++--- 1 file changed, 9 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 69c1433f2..4afc8f876 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -7,8 +7,10 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'json' describe RequestController, "when listing recent requests" do - + fixtures :info_requests, :outgoing_messages, :users, :info_request_events, :public_bodies, :public_body_translations, :incoming_messages, :raw_emails, :comments + before(:each) do + load_raw_emails_data(raw_emails) rebuild_xapian_index end @@ -496,7 +498,7 @@ describe RequestController, "when classifying an information request" do fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages, :comments # all needed as integrating views - before do + before(:each) do @dog_request = info_requests(:fancy_dog_request) @dog_request.stub!(:is_old_unclassified?).and_return(false) InfoRequest.stub!(:find).and_return(@dog_request) @@ -831,7 +833,11 @@ end describe RequestController, "when sending a followup message" do integrate_views fixtures :info_requests, :info_request_events, :public_bodies, :public_body_translations, :users, :incoming_messages, :raw_emails, :outgoing_messages # all needed as integrating views - + + before(:each) do + load_raw_emails_data(raw_emails) + end + it "should require login" do post :show_response, :outgoing_message => { :body => "What a useless response! You suck.", :what_doing => 'normal_sort' }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_followup => 1 post_redirect = PostRedirect.get_last_post_redirect -- cgit v1.2.3 From fd3763c2a20af24428307a0dd1936d927ed323e2 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Fri, 12 Aug 2011 16:24:23 +0100 Subject: When displaying information about how overdue something is, use values from the config file, rather than hard coded ones. Fixes #130. --- spec/controllers/request_controller_spec.rb | 2 ++ 1 file changed, 2 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 4afc8f876..dcd33d279 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -778,6 +778,8 @@ describe RequestController, "when classifying an information request" do @dog_request.stub!(:date_very_overdue_after).and_return(Time.now.to_date-1) expect_redirect('waiting_response', unhappy_url) flash[:notice].should match(/is long overdue/) + flash[:notice].should match(/by more than 40 working days/) + flash[:notice].should match(/within 20 working days/) end it 'should redirect to the "request url" when status is updated to "not held"' do -- cgit v1.2.3 From 7c5d08c75536d49b6131c16367d99009d167a4b1 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Mon, 15 Aug 2011 11:51:28 +0100 Subject: Fix template syntax error. Closes #136 --- spec/controllers/request_controller_spec.rb | 7 +++++++ 1 file changed, 7 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 dcd33d279..a9315ddb2 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -308,6 +308,13 @@ describe RequestController, "when creating a new request" do response.should redirect_to(:controller => 'general', :action => 'frontpage') end + it "should redirect 'bad request' page when a body has no email address" do + @body.request_email = "" + @body.save! + get :new, :public_body_id => @body.id + response.should render_template('new_bad_contact') + end + it "should accept a public body parameter" do get :new, :public_body_id => @body.id assigns[:info_request].public_body.should == @body -- cgit v1.2.3 From 7c7d7187b682f926e39231bcc748b0694d594445 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Wed, 17 Aug 2011 10:52:15 +0100 Subject: Add test for generation of HTML versions of attachments. As a side-effect, make some of the HTML more valid. Prerequisite for addressing issue #108. --- spec/controllers/request_controller_spec.rb | 8 ++++++++ 1 file changed, 8 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 a9315ddb2..f69cf414c 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -125,6 +125,14 @@ describe RequestController, "when showing one request" do response.should have_text(/First hello/) end + it "should generate valid HTML verson of plain text attachments " do + ir = info_requests(:fancy_dog_request) + receive_incoming_mail('incoming-request-two-same-name.email', ir.incoming_email) + get :get_attachment_as_html, :incoming_message_id => ir.incoming_messages[1].id, :id => ir.id, :part => 2, :file_name => ['hello.txt.html'], :skip_cache => 1 + response.content_type.should == "text/html" + response.should have_text(/Second hello/) + end + it "should treat attachments with unknown extensions as binary" do ir = info_requests(:fancy_dog_request) receive_incoming_mail('incoming-request-attachment-unknown-extension.email', ir.incoming_email) -- cgit v1.2.3