Skip to content

Commit

Permalink
test: Add a test for the posting check in
Browse files Browse the repository at this point in the history
  • Loading branch information
viroulep committed Oct 13, 2023
1 parent 00dd196 commit c50fe36
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions WcaOnRails/spec/requests/admin_results_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

require "rails_helper"

RSpec.describe "Admin Results" do
describe "Posting Check In" do
let!(:competition) { FactoryBot.create :competition, :with_valid_submitted_results }
let!(:wrt_member) { FactoryBot.create :user, :wrt_member }

it "locks a competition and returns the correct attributes" do
sign_in wrt_member
post start_posting_path, params: {
'competition_ids' => [competition.id],
}
expect(response).to be_successful
response_json = JSON.parse(response.body)
expect(response_json["message"]).to eq "Competitions successfully locked, go on posting!"
get results_posting_dashboard_path(format: :json)
expect(response).to be_successful
competitions = JSON.parse(response.body)["competitions"]
expect(competitions.size).to eq 1
expect(competitions[0]["id"]).to eq competition.id
expect(competitions[0]["posting_user"]["id"]).to eq wrt_member.id
end
end
end

0 comments on commit c50fe36

Please sign in to comment.