Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorbg committed Jan 9, 2025
1 parent 1c2aaed commit be528b4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions spec/features/competitions_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "rails_helper"

RSpec.feature "Competitions list" do
RSpec.feature "Competitions list", js: true do
context "admin view" do
before :each do
sign_in FactoryBot.create(:admin)
Expand All @@ -13,18 +13,18 @@
let(:delegate) { competition.delegates.first }

before do
visit "/competitions?legacy=off&show_admin_details=yes"
visit "/competitions?show_admin_details=yes"
within(:css, "#delegate") do
find(".search").set(delegate.name)
find(".search").send_keys(:enter)
end
end

it "the delegate is selected within the form", js: true do
it "the delegate is selected within the form" do
expect(page.find("#competition-query-form #delegate")).to have_text(delegate.name)
end

it "only competitions delegated by the given delegate are shown", js: true do
it "only competitions delegated by the given delegate are shown" do
expect(page).to have_selector(".competition-info", count: 1)
end
end
Expand All @@ -33,11 +33,11 @@
FactoryBot.create(:competition, :visible, starts: 2.days.ago, name: "Test Comp 2017")
visit '/competitions?state=recent&display=admin'
expect(page).to have_http_status(200)
expect(page).to have_text "Test Comp 2017"
tr = page.find("tr", text: "Test Comp 2017")

results_td = tr.find("td:nth-child(6).admin-date")
expect(results_td.text).to eq "pending"
expect(results_td[:class].split).to match_array %w(admin-date)
results_td = tr.find("td:nth-child(7)")
expect(results_td.text).to eq "Pending"
end
end
end

0 comments on commit be528b4

Please sign in to comment.