Сконфигурируйте свою тестовую среду для накопления отправленных писем в ActionMailer::Base.deliveries
.
# config/environments/test.rb
config.action_mailer.delivery_method = :test
Тогда что-то вроде этого должно позволить вам проверить, что письмо было отправлено.
# Sample parameters you would expect for POST #create.
def reservation_params
{ "reservation" => "Drinks for two at 8pm" }
end
describe MyController do
describe "#create" do
context "when a reservation is saved" do
it "sends a confirmation email" do
expect { post :create, reservation_params }.to change { ActionMailer::Base.deliveries.count }.by(1)
end
end
end
end
Обратите внимание, что в моем примере используется синтаксис RSpec 3.
Openquery подключается напрямую к целевому серверу. Несмотря на то, что вы сказали «РСУБД», вы не сказали, каков другой способ связи с данными.
Do you know if it is trying to enlist a distributed transaction over the linked server? If you watch the Trace output from Oracle when the calls are made, you should be able to see the difference in the requests happening. IIRC, the standard link query will request schema information from the oracle metadata in a different manner than the OPENQUERY call does. I don't know exactly why this happens, but I had a similar issue in the past that was resolved by using OPENQUERY.
OPENQUERY подключается к целевому серверу, выполняет запрос на этом сервере и возвращает набор результатов. В то время как запрос Linked Server выполняется на локальном сервере и проходит через соединение.
Надеюсь, это поможет.