aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/request_controller_spec.rb2
-rw-r--r--spec/models/incoming_message_spec.rb14
2 files changed, 16 insertions, 0 deletions
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
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index 5fcc534ca..183a258af 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -19,6 +19,13 @@ describe IncomingMessage, " when dealing with incoming mail" do
end
+describe IncomingMessage, "when parsing HTML mail" do
+ it "should display UTF-8 characters in the plain text version correctly" do
+ html = "<html><b>foo</b> është"
+ plain_text = IncomingMessage._get_attachment_text_internal_one_file('text/html', html)
+ plain_text.should match(/është/)
+ end
+end
describe IncomingMessage, "when getting the attachment text" do
@@ -201,6 +208,13 @@ describe IncomingMessage, " when censoring data" do
data.should == "There was a mouse called Jarlsberg, he wished that he was yellow."
end
+ it "should apply hard-coded privacy rules to HTML files" do
+ domain = MySociety::Config.get('DOMAIN')
+ data = "http://#{domain}/c/cheese"
+ @im.html_mask_stuff!(data)
+ data.should == "[WDTK login link]"
+ end
+
it "should apply censor rules to From: addresses" do
mock_mail = mock('Email object')
mock_mail.stub!(:from_name_if_present).and_return("Stilton Mouse")