diff options
author | Louise Crow <louise.crow@gmail.com> | 2015-05-29 14:51:00 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2015-05-29 14:51:00 +0100 |
commit | 840fda9b310cde8bc72df1a93fdc47b1d817f552 (patch) | |
tree | abef4b1adb27f38b172f2938d9537be4031dcc7f | |
parent | b7a40c15d8c69a02edfc68e2681b3f68228ce8f0 (diff) | |
parent | d59a325de7cb43f114412a8ad62c60b331b8b19a (diff) |
Merge branch 'hotfix/0.21.0.35' into rails-3-developrails-3-develop
-rw-r--r-- | config/initializers/alaveteli.rb | 2 | ||||
-rw-r--r-- | lib/mail_handler/backends/mail_backend.rb | 6 | ||||
-rw-r--r-- | spec/lib/acts_as_xapian_spec.rb | 10 | ||||
-rw-r--r-- | spec/lib/mail_handler/backends/mail_backend_spec.rb | 17 |
4 files changed, 27 insertions, 8 deletions
diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb index 35c54c7ff..fe385b146 100644 --- a/config/initializers/alaveteli.rb +++ b/config/initializers/alaveteli.rb @@ -11,7 +11,7 @@ load "debug_helpers.rb" load "util.rb" # Application version -ALAVETELI_VERSION = '0.21.0.34' +ALAVETELI_VERSION = '0.21.0.35' # Add new inflection rules using the following format # (all these examples are active by default): diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb index 9e3fbc008..34fbc91ab 100644 --- a/lib/mail_handler/backends/mail_backend.rb +++ b/lib/mail_handler/backends/mail_backend.rb @@ -368,11 +368,11 @@ module MailHandler raise "invalid email " + email + " passed to address_from_name_and_email" end if name.nil? - return Mail::Address.new(email).to_s + return Mail::Address.new(email.dup).to_s end address = Mail::Address.new - address.display_name = name - address.address = email + address.display_name = name.dup + address.address = email.dup address.to_s end diff --git a/spec/lib/acts_as_xapian_spec.rb b/spec/lib/acts_as_xapian_spec.rb index 1d9256441..9e4383b8e 100644 --- a/spec/lib/acts_as_xapian_spec.rb +++ b/spec/lib/acts_as_xapian_spec.rb @@ -6,14 +6,15 @@ describe ActsAsXapian::Search do describe "#words_to_highlight" do before :all do + get_fixtures_xapian_index # make sure an index exists @alice = FactoryGirl.create(:public_body, :name => 'alice') - ActsAsXapian.update_index + update_xapian_index end after :all do @alice.destroy - ActsAsXapian.update_index + update_xapian_index end it "should return a list of words used in the search" do @@ -81,15 +82,16 @@ describe ActsAsXapian::Search do describe :spelling_correction do before :all do + get_fixtures_xapian_index @alice = FactoryGirl.create(:public_body, :name => 'alice') @bob = FactoryGirl.create(:public_body, :name => 'bôbby') - ActsAsXapian.update_index + update_xapian_index end after :all do @alice.destroy @bob.destroy - ActsAsXapian.update_index + update_xapian_index end it 'returns a UTF-8 encoded string' do diff --git a/spec/lib/mail_handler/backends/mail_backend_spec.rb b/spec/lib/mail_handler/backends/mail_backend_spec.rb index 044fbef4f..91d9e1b5a 100644 --- a/spec/lib/mail_handler/backends/mail_backend_spec.rb +++ b/spec/lib/mail_handler/backends/mail_backend_spec.rb @@ -151,4 +151,21 @@ DOC end + describe :address_from_name_and_email do + + it 'returns an address string' do + expected = 'Test User <test@example.com>' + address_from_name_and_email('Test User', 'test@example.com').should == expected + end + + it 'does not change the name passed to it' do + original = "brønn" + name = original.dup + address_from_name_and_email(name, 'test@example.com') + name.should == original + end + + end + + end |