Я использую почтовый перехватчик следующим образом:
setup_mail.rb
Mail.register_interceptor(MailInterceptor) if Rails.env != "production"
класс MailInterceptor
class MailInterceptor
def self.delivering_email(message)
message.subject = "#{message.subject} [#{message.to}]"
message.to = "[email protected]"
end
end
Я не могу создать rspec для этого перехватчика, так как это не происходит с использованием спецификации rake.
У меня есть следующая спецификация:
describe "MailInterceptor" do
it "should be intercepted" do
@email = UserMailer.registration_automatically_generated(@user)
@email.should deliver_to("[email protected]")
end
end
В test.log я вижу, что deliver_to не является перехватчиком. Любые идеи о том, как я могу написать rspec для перехватчика?
Спасибо