Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
dunkOnIT committed Aug 10, 2024
1 parent b48380a commit aec32f1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/registration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def update_payment_lane(id, iso_amount, currency_iso, status)
# Dynamoid doesn't have a find_or_create_by so we need to use upsert
# There are no validations to run anyway
def update_waiting_list(update_params)
raise ArgumentError, 'Can only accept waiting list leader' if waiting_list_position != 1 && update_params[:status] == 'accepted'
raise ArgumentError.new('Can only accept waiting list leader') if waiting_list_position != 1 && update_params[:status] == 'accepted'

waiting_list = WaitingList.find(competition_id)
waiting_list.add(self.user_id) if update_params[:status] == 'waiting_list'
Expand Down
2 changes: 1 addition & 1 deletion app/models/waiting_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def add(user_id)
end

def move_to_position(user_id, new_position)
raise ArgumentError, 'Target position out of waiting list range' if new_position > entries.length || new_position < 1
raise ArgumentError.new('Target position out of waiting list range') if new_position > entries.length || new_position < 1

old_index = entries.find_index(user_id)
return if old_index == new_position-1
Expand Down
2 changes: 1 addition & 1 deletion app/services/registration_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def validate_update_status!
new_status == 'accepted' && Registration.accepted_competitors_count(@competition_info.competition_id) == @competition_info.competitor_limit

# Organizers cant accept someone from the waiting list who isn't in the leading position
waiting_list = begin
begin
WaitingList.find(@competition_info.id)
rescue Dynamoid::Errors::RecordNotFound
WaitingList.create(id: @competition_info.id, entries: [])
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/waiting_list_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

FactoryBot.define do
factory :waiting_list do
transient do
transient do
populate { nil }
end

Expand Down
8 changes: 4 additions & 4 deletions spec/services/registration_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
it "user cant change 'status' => #{old_status} to: #{new_status}" do
registration = FactoryBot.create(:registration, registration_status: old_status)
if old_status == 'waiting_list'
waiting_list = FactoryBot.create(:waiting_list, entries: [registration.user_id])
FactoryBot.create(:waiting_list, entries: [registration.user_id])
end
competition_info = CompetitionInfo.new(FactoryBot.build(:competition))
update_request = FactoryBot.build(:update_request, user_id: registration[:user_id], competing: { 'status' => new_status })
Expand All @@ -28,7 +28,7 @@
it "organizer can change 'status' => #{old_status} to: #{new_status} before close" do
registration = FactoryBot.create(:registration, registration_status: old_status)
if old_status == 'waiting_list'
waiting_list = FactoryBot.create(:waiting_list, entries: [registration.user_id])
FactoryBot.create(:waiting_list, entries: [registration.user_id])
end
competition_info = CompetitionInfo.new(FactoryBot.build(:competition))
update_request = FactoryBot.build(:update_request, :organizer_for_user, user_id: registration[:user_id], competing: { 'status' => new_status })
Expand All @@ -45,7 +45,7 @@
it "site admin can change 'status' => #{old_status} to: #{new_status} before close" do
registration = FactoryBot.create(:registration, registration_status: old_status)
if old_status == 'waiting_list'
waiting_list = FactoryBot.create(:waiting_list, entries: [registration.user_id])
FactoryBot.create(:waiting_list, entries: [registration.user_id])
end
competition_info = CompetitionInfo.new(FactoryBot.build(:competition))
update_request = FactoryBot.build(:update_request, :site_admin, user_id: registration[:user_id], competing: { 'status' => new_status })
Expand All @@ -62,7 +62,7 @@
it "after edit deadline/reg close, organizer can change 'status' => #{old_status} to: #{new_status}" do
registration = FactoryBot.create(:registration, registration_status: old_status)
if old_status == 'waiting_list'
waiting_list = FactoryBot.create(:waiting_list, entries: [registration.user_id])
FactoryBot.create(:waiting_list, entries: [registration.user_id])
end
competition_info = CompetitionInfo.new(FactoryBot.build(:competition, :closed))
update_request = FactoryBot.build(:update_request, :organizer_for_user, user_id: registration[:user_id], competing: { 'status' => new_status })
Expand Down

0 comments on commit aec32f1

Please sign in to comment.