I start with ruby on rails and create an example application. In this application, I have a mail class and a test Mail class. I managed to get all the tests except the tests from ActionMailer :: TestCase. Every time I run tests, an error message appears:
NoMethodError: undefined method 'env' for nil: NilClass.
My mail verification method is as follows:
test "new_project" do
mail = ProjectMailer.new_project
assert_equal "New project", mail.subject
assert_equal ["to@example.org"], mail.to
assert_equal ["from@example.com"], mail.from
assert_match "Hi", mail.body.encoded
end
I have in test_helper
class ActionController::TestCase
include Devise::TestHelpers
end
class ActionMailer::TestCase
include Devise::TestHelpers
end
class ActiveSupport::TestCase
ActiveRecord::Migration.check_pending!
include Devise::TestHelpers
fixtures :all
end
Does anyone know how to solve this?
source
share