From 7705f6754184d471fb5da38c5d8671a7737bcdd6 Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Thu, 11 Aug 2011 17:54:29 +0100 Subject: Remove more whatdotheyknow references. Closes #113 (I think). --- spec/models/incoming_message_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec/models') diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index 5fcc534ca..ad7aa8d43 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -201,6 +201,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") -- cgit v1.2.3 From dbac4121cae0d620c7c11c6731fe5344ff1c677e Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Fri, 12 Aug 2011 16:06:28 +0100 Subject: Force elinks to assume UTF8 character set for its input (used when making plain text versions of HTML email) --- spec/models/incoming_message_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec/models') diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index ad7aa8d43..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 = "foo ë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 -- cgit v1.2.3 From f6516d55f75752bf1eb7773f0a09cc6200bc9fad Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Mon, 15 Aug 2011 12:12:43 +0100 Subject: Internationalise the salution, making sure it's OK to miss out the public body name as they might in French. Fixes #134. --- spec/models/outgoing_message_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec/models') diff --git a/spec/models/outgoing_message_spec.rb b/spec/models/outgoing_message_spec.rb index a9ef57b4f..1956c4d73 100644 --- a/spec/models/outgoing_message_spec.rb +++ b/spec/models/outgoing_message_spec.rb @@ -1,7 +1,10 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe OutgoingMessage, " when making an outgoing message" do + fixtures :outgoing_messages, :info_requests, :incoming_messages, :public_bodies, :public_body_translations + before do + @om = outgoing_messages(:useless_outgoing_message) @outgoing_message = OutgoingMessage.new({ :status => 'ready', :message_type => 'initial_request', @@ -27,6 +30,10 @@ describe OutgoingMessage, " when making an outgoing message" do it "should include email addresses in outgoing messages" do @outgoing_message.body.should include("foo@bar.com") end + + it "should work out a salutation" do + @om.get_salutation.should == "Dear Geraldine Quango," + end end -- cgit v1.2.3 From 95e357b02b75de103d93180e3a33417f0c83dfb3 Mon Sep 17 00:00:00 2001 From: David Cabo Date: Tue, 16 Aug 2011 03:50:11 +0200 Subject: Don't fail if a body has the same url_name in several locales (closes #139) --- spec/models/public_body_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'spec/models') diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb index ec84cbe65..3d00d37fb 100644 --- a/spec/models/public_body_spec.rb +++ b/spec/models/public_body_spec.rb @@ -210,6 +210,20 @@ describe PublicBody, "when searching" do body.id.should == 3 body.class.to_s.should == 'PublicBody' end + + it "should cope with same url_name across multiple locales" do + PublicBody.with_locale(:es) do + # use the unique spanish name to retrieve and edit + body = PublicBody.find_by_url_name_with_historic('etgq') + body.short_name = 'tgq' # Same as english version + body.save! + + # now try to retrieve it + body = PublicBody.find_by_url_name_with_historic('tgq') + body.id.should == public_bodies(:geraldine_public_body).id + body.name.should == "El A Geraldine Quango" + end + end end describe PublicBody, " when loading CSV files" do -- cgit v1.2.3