Remove database expectations in remotely translatable tests

In the past, having this kind of expectations after the process running
the browser has started has resulted in flaky issues with the database
connection.

In one case, we're removing the test because there are controller tests
covering the same scenario and a system test checking what happens from
the user perspective.

In the other case, we're replacing the expectations with expectations
from the user's point of view.
This commit is contained in:
Javi Martín
2024-09-23 15:10:25 +02:00
parent 3ab9fb1d27
commit 314019bee7

View File

@@ -135,13 +135,6 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
context "After click remote translations button" do
describe "with delayed jobs", :delay_jobs do
scenario "the remote translation is pending to translate" do
visit path
select "Español", from: "Language:"
expect { click_button "Traducir página" }.to change { RemoteTranslation.count }.from(0).to(1)
end
scenario "shows informative text when content is enqueued" do
visit path
select "Español", from: "Language:"
@@ -163,17 +156,19 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume
end
describe "without delayed jobs" do
scenario "the remote translation has been translated and destoyed" do
scenario "content is immediately translated" do
response = generate_response(resource)
expect_any_instance_of(RemoteTranslations::Microsoft::Client).to receive(:call).and_return(response)
visit path
select "Español", from: "Language:"
expect(page).to have_select "Idioma:"
expect(page).not_to have_content response.first
click_button "Traducir página"
expect(page).not_to have_button "Traducir página"
expect(RemoteTranslation.count).to eq(0)
expect(resource.translations.count).to eq(2)
expect(page).to have_content response.first
end
scenario "request a translation of an already translated text" do