There is a before_action callback method in my ActionMailer object which is responsible for setting some instance variables.
class TestMailer < ApplicationMailer
before_action :set_params
def send_test_mail
mail(to: @email, subject: subject)
end
def set_params
@account = account.email
@date = some_action(account.updated_at)
end
end
The question is How one can test these variables in a rspec test? some thing like:
describe TestMailer do
describe '#set_params' do
described_class.with(account: account, subject: subject).send_test_mail.deliver_now
expect(@date).to eq(Date.today)
end
end
any clue would be highly appreciated.