I am not trying to test rake tasks. I have a test program which sends out emails ( real emails yes) to test email templates etc.
class EmailTemplatesTest < ActiveSupport::TestCase
context 'send_password_info' do
setup do
Emailtb.send_password_info(user)
Rake::Task['email:run'].invoke # this actually delivers email
end
should 'have one emailtb' do
assert_equal 1, Emailtb.count
end
end
end
When I run this test then I get following error.
RuntimeError: Don't know how to build task 'email:run'
However if I run the rake task separately then it works fine
rake email:run