diff options
author | Mark Longair <mhl@pobox.com> | 2013-11-26 15:23:05 +0000 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2013-11-29 08:59:35 +0000 |
commit | c64692cd3d10f7432c9d5350610a6799b1e1419b (patch) | |
tree | 6c88ec5067d3fbbf16b3050184e4db8e931445da /spec/lib | |
parent | f91d66d42f517f778cac130466b7cffc7fd8b085 (diff) | |
parent | 70ae965de187244d5fde7dfff9c1c274fbba581f (diff) |
Merge branch 'feature/rails-3-2-upgrade-spike' into feature/switch-to-asset-pipeline
Conflicts:
Gemfile.lock
app/assets/images/admin-theme/ui-bg_flat_0_aaaaaa_40x100.png
app/assets/images/admin-theme/ui-bg_flat_55_fbf9ee_40x100.png
app/assets/images/admin-theme/ui-bg_flat_65_ffffff_40x100.png
app/assets/images/admin-theme/ui-bg_flat_75_cccccc_40x100.png
app/assets/images/admin-theme/ui-bg_flat_75_dadada_40x100.png
app/assets/images/admin-theme/ui-bg_flat_75_e6e6e6_40x100.png
app/assets/images/admin-theme/ui-bg_flat_75_ffffff_40x100.png
app/assets/images/admin-theme/ui-bg_inset-soft_95_fef1ec_1x100.png
app/assets/images/admin-theme/ui-icons_222222_256x240.png
app/assets/images/admin-theme/ui-icons_2e83ff_256x240.png
app/assets/images/admin-theme/ui-icons_454545_256x240.png
app/assets/images/admin-theme/ui-icons_888888_256x240.png
app/assets/images/admin-theme/ui-icons_cd0a0a_256x240.png
app/assets/javascripts/admin.js
app/assets/javascripts/admin/jquery-ui.min.js
app/assets/javascripts/application.js
app/assets/javascripts/jquery-ui.min.js
app/assets/javascripts/jquery.flot.errorbars.min.js
app/assets/javascripts/jquery.flot.min.js
app/assets/javascripts/stats.js
app/assets/stylesheets/application.css
app/assets/stylesheets/fonts.scss
app/views/general/_stylesheet_includes.html.erb
app/views/layouts/admin.html.erb
app/views/layouts/default.html.erb
app/views/public_body/statistics.html.erb
config/application.rb
config/environments/development.rb
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/mail_handler/mail_handler_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/sendmail_return_path_spec.rb | 88 |
2 files changed, 1 insertions, 89 deletions
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb index aa351bd94..bc027eaec 100644 --- a/spec/lib/mail_handler/mail_handler_spec.rb +++ b/spec/lib/mail_handler/mail_handler_spec.rb @@ -235,7 +235,7 @@ describe 'when deriving a name, email and formatted address from a message from it 'should quote a name with quotes in it' do should_render_from_address('"FOI \" Person" <foiperson@localhost>', - ['FOI \" Person', + ['FOI " Person', 'foiperson@localhost', '"FOI \" Person" <foiperson@localhost>']) end diff --git a/spec/lib/sendmail_return_path_spec.rb b/spec/lib/sendmail_return_path_spec.rb deleted file mode 100644 index 83436c2bd..000000000 --- a/spec/lib/sendmail_return_path_spec.rb +++ /dev/null @@ -1,88 +0,0 @@ -# This is a test of the monkey patches in sendmail_return_path.rb - -# In Rails 3 the monkeypatches are not needed anymore because sendmail now has the "-f" flag -# set correctly. So, strictly these tests are testing the Rails internals. So, that means we really -# should delete them. Let's do that later when things have settled down. For the time being leave -# them in - -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') - -describe "when sending email with an altered return path" do - before(:each) { ActionMailer::Base.deliveries = [] } - - it "should default to delivery method test" do - ActionMailer::Base.delivery_method.should == :test - end - - it "should let the helper change the method" do - with_delivery_method :smtp do - ActionMailer::Base.delivery_method.should == :smtp - end - ActionMailer::Base.delivery_method.should == :test - end - - # Documentation for fancy mock functions: http://rspec.info/documentation/mocks/message_expectations.html - it "should set the return path when sending email using SMTP" do - mock_smtp = mock("smtp") - mock_smtp_session = mock("smtp_session") - - mock_smtp.should_receive(:start).once.and_yield(mock_smtp_session) - # the second parameter to the SMTP session is the sender (return path) - mock_smtp_session.should_receive(:sendmail).once.with(anything(), "test@localhost", anything()) - - Net::SMTP.stub!(:new).and_return(mock_smtp) - - with_delivery_method :smtp do - ContactMailer.to_admin_message( - "Mr. Test", "test@localhost", "Test script spec/lib/sendmail_return_path_spec.rb", - "This is just a test for a test script", nil, nil, nil - ).deliver - end - - deliveries = ActionMailer::Base.deliveries - deliveries.size.should == 0 - end - - it "should set the return path when sending email using sendmail" do - with_stub_popen do - IO.should_receive(:popen).once.with('/usr/sbin/sendmail -i -t -f "test@localhost" postmaster@localhost', "w+") - with_delivery_method :sendmail do - ContactMailer.to_admin_message( - "Mr. Test", "test@localhost", "Test script spec/lib/sendmail_return_path_spec.rb", - "This is just a test for a test script", nil, nil, nil - ).deliver - end - end - - deliveries = ActionMailer::Base.deliveries - deliveries.size.should == 0 - end - - - protected - # Change the way Rails delivers memory, just for current scope - def with_delivery_method(new_delivery_method) - old_delivery_method, ActionMailer::Base.delivery_method = ActionMailer::Base.delivery_method, new_delivery_method - yield - ensure - ActionMailer::Base.delivery_method = old_delivery_method - end - - # By default, we can't stub popen, presumably because it is a builtin written in C. - # Replace it entirely with a normal method that just calls the C one, so we can stub it - - # this leaves IO working afterwards (for other tests that run in the same instance). - def with_stub_popen() - IO.class_eval "@orig_popen = self.method(:popen); def self.popen(a, b, &c); @orig_popen.call(a, b, &c); end" - begin - yield - ensure - # in theory would undo the popen alterations and return IO to a pristine state, but - # don't know how to (much fiddling with alias bind and the like didn't help). It - # doesn't matter - the new popen should behave just the same. - end - end - - -end - - |