In my rails application, the registration class is below the functions,
def register_email
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 them.
- Test about add_to_other_thread (& blcok):
After add_to_other_thread is called with some block, check if it called Thread.new with the correct block.
Register_email test: After calling register_email, check if add_to_other_thread (& block) received the correct block or not.- In the integrated test:
After registering the user, check if the proper e-mail was sent (using ActionMailer :: Base.deliveries) through another stream.