-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
serialization: restore initial behavior (#8418)
* serialization: restore initial behavior This also explicitly lists all expected attributes when "showing" a competition's json. * test: Add a test for the posting check in
- Loading branch information
Showing
5 changed files
with
44 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |