Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
taitus committed Sep 23, 2024
1 parent b7806a3 commit 74e6047
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 8 additions & 7 deletions spec/shared/system/remotely_translatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,29 @@

context "After click remote translations button" do
describe "without delayed jobs" do

scenario "request a translation of an already translated text" do
response = generate_response(resource)
expect_any_instance_of(RemoteTranslations::Microsoft::Client).to receive(:call).and_return(response)

in_browser(:one) do
# Navegador 1: Usa la sesión de Capybara para el primer usuario
Capybara.using_session(:user_one) do
visit path
select "Español", from: "Language:"

expect(page).to have_button "Traducir página"
end

in_browser(:two) do
# Navegador 2: Usa una segunda sesión de Capybara para el segundo usuario
Capybara.using_session(:user_two) do
visit path
select "Español", from: "Language:"
click_button "Traducir página"

expect(page).to have_content "Se han solicitado correctamente las traducciones"
expect(page).to have_content I18n.t("remote_translations.create.enqueue_remote_translation"), wait: 10
end

in_browser(:one) do
# Volver a Navegador 1 para realizar más acciones
Capybara.using_session(:user_one) do
click_button "Traducir página"

expect(page).not_to have_button "Traducir página"
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Dir["./spec/shared/**/*.rb"].sort.each { |f| require f }

RSpec.configure do |config|
Capybara.always_include_port = false
config.use_transactional_fixtures = true
config.fixture_path = "spec/fixtures/files"

Expand Down

0 comments on commit 74e6047

Please sign in to comment.