Files
puzzle-scoreboard/spec/system/export_spec.rb
sto e9c09a3196
Some checks failed
CI / scan_ruby (push) Successful in 16s
CI / scan_js (push) Successful in 13s
CI / lint (push) Successful in 13s
CI / test (push) Failing after 1m28s
CI: install gem webdrivers
#5
2025-12-12 10:45:21 +01:00

39 lines
1010 B
Ruby

require 'rails_helper'
RSpec.describe "Exports", type: :system do
let!(:user) { create(:user) }
before do
driven_by :selenium_chrome_with_download_headless
end
after do
clear_downloads
end
context "when in a contest with at least one contestant" do
let!(:contest) { create(:contest, user: user) }
let!(:first_contestant) { create(:contestant, contest: contest) }
let!(:second_contestant) { create(:contestant, contest: contest) }
it "should be possible to export the list of contestants", :with_downloads do
login(user)
sleep 0.6
visit contest_contestants_path(contest)
click_link I18n.t("helpers.buttons.export")
wait_for_download
expect(downloads.length).to eq(1)
expect(last_download).to include("#{contest.friendly_id}_results.csv")
results_csv = File.read(last_download)
expect(results_csv).to include(first_contestant.name)
expect(results_csv).to include(second_contestant.name)
end
end
end