aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2015-11-04 16:32:53 -0500
committerYves Senn <yves.senn@gmail.com>2015-11-04 16:35:31 -0500
commita80fb6f9b3b553b59a486d7aa4673cc47397fab5 (patch)
tree6fa2eb2d8e1e229ad0021faac94b9ba697990280 /actionmailer
parent7b471dbf5bdab9579962e71bcf2e24e01bcc99ef (diff)
downloadrails-a80fb6f9b3b553b59a486d7aa4673cc47397fab5.tar.gz
rails-a80fb6f9b3b553b59a486d7aa4673cc47397fab5.tar.bz2
rails-a80fb6f9b3b553b59a486d7aa4673cc47397fab5.zip
tests, define `Rails.root` before loading Action Mailer.
Since `bin/test` would define `Rails.root` before loading AM but `bundle exec rake` would define it after loading AM, this lead to the following test failure when using `bin/test`: ``` --- expected +++ actual @@ -1 +1 @@ -{:location=>"/var/folders/_r/9kh50y4j0vn7zgg2p65z1lcm0000gn/T/mails"} +{:location=>"/Users/senny/Projects/rails/actionmailer/tmp/mails"} ``` This patch ensures that `Rails.root` is defined when loading AM to achieve consistent test results.
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/test/abstract_unit.rb12
-rw-r--r--actionmailer/test/delivery_methods_test.rb4
2 files changed, 8 insertions, 8 deletions
diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb
index 85d3629514..285b2cfcb5 100644
--- a/actionmailer/test/abstract_unit.rb
+++ b/actionmailer/test/abstract_unit.rb
@@ -8,6 +8,12 @@ silence_warnings do
Encoding.default_external = "UTF-8"
end
+module Rails
+ def self.root
+ File.expand_path('../', File.dirname(__FILE__))
+ end
+end
+
require 'active_support/testing/autorun'
require 'active_support/testing/method_call_assertions'
require 'action_mailer'
@@ -26,12 +32,6 @@ I18n.enforce_available_locales = false
FIXTURE_LOAD_PATH = File.expand_path('fixtures', File.dirname(__FILE__))
ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH
-module Rails
- def self.root
- File.expand_path('../', File.dirname(__FILE__))
- end
-end
-
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = '')
skip message if RUBY_ENGINE == 'rbx'
diff --git a/actionmailer/test/delivery_methods_test.rb b/actionmailer/test/delivery_methods_test.rb
index d17e774092..2786fe0d07 100644
--- a/actionmailer/test/delivery_methods_test.rb
+++ b/actionmailer/test/delivery_methods_test.rb
@@ -31,8 +31,8 @@ class DefaultsDeliveryMethodsTest < ActiveSupport::TestCase
assert_equal settings, ActionMailer::Base.smtp_settings
end
- test "default file delivery settings" do
- settings = {location: "#{Dir.tmpdir}/mails"}
+ test "default file delivery settings (with Rails.root)" do
+ settings = {location: "#{Rails.root}/tmp/mails"}
assert_equal settings, ActionMailer::Base.file_settings
end