In my rails app, Signup Class has below functions,
def register_email
# Something...
add_to_other_thread do
send_verification_email
end
end
def add_to_other_thread(&block)
Thread.new do
yield
ActiveRecord::Base.connection.close
end
end
And I want to do 3 tests with these.
- Test about add_to_other_thread(&blcok):
After add_to_other_thread being called with some block, Check whether or not it called Thread.new with proper block. - Test about register_email:
After register_email being called, Check whether add_to_other_thread(&block) got proper block or not. - In Integral Test:
After User signing up, Check whether or not proper email was sent(with ActionMailer::Base.deliveries) via other Thread.
Aucun commentaire:
Enregistrer un commentaire