From 314019bee758623b584a2065b88bf3c00224fcdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 23 Sep 2024 15:10:25 +0200 Subject: [PATCH] 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. --- spec/shared/system/remotely_translatable.rb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/spec/shared/system/remotely_translatable.rb b/spec/shared/system/remotely_translatable.rb index 3ad197d49..ee61d001d 100644 --- a/spec/shared/system/remotely_translatable.rb +++ b/spec/shared/system/remotely_translatable.rb @@ -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