Skip to content

Commit

Permalink
Fix camp application market participation moves, refs #20
Browse files Browse the repository at this point in the history
  • Loading branch information
mtnstar authored and TheWalkingLeek committed Mar 11, 2024
1 parent 46f85b4 commit 7922a01
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/fabricators/event_fabricator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

# Copyright (c) 2023-2024, Jungschar EMK. This file is part of
# hitobito_jemk and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jemk.

Fabricator(:jemk_camp, from: :event, class_name: :'Event::Camp')
46 changes: 46 additions & 0 deletions spec/features/event/application_market_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# frozen_string_literal: true

# Copyright (c) 2012-2024, Jungschar EMK. This file is part of
# hitobito_jemk and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jemk.

require 'spec_helper'

describe Event::ApplicationMarketController, js: true do

context 'camp' do
let(:fruela_admin) do
Fabricate(Group::Lagerverein::Administrator.name.to_sym, group: group).person
end
let(:group) { groups(:fruela) }
let(:camp) { Fabricate(:jemk_camp, name: 'FrüLa 2033', groups: [group]) }

let!(:participation) do
event_application = Event::Application.create!(
priority_1: camp)

Fabricate(:event_participation,
event: camp,
active: true,
application: event_application)
end

it 'moves participation from applied to assigned and back' do
sign_in(fruela_admin)
visit group_event_application_market_index_path(group.id, camp.id)

expect(page).to have_text('FrüLa 2033')
expect(page).to have_css("#applications a", text: participation.person.to_s(:list))
all("#applications #event_participation_#{participation.id} td").first.find('a').click
expect(page).not_to have_css("#participants a", text: participation.person.to_s(:list))

expect(page).to have_css("#participants a", text: participation.person.to_s(:list))
all("#participants #event_participation_#{participation.id} td").last.find('a').click

expect(page).not_to have_css("#participants a", text: participation.person.to_s(:list))
expect(page).to have_css("#applications a", text: participation.person.to_s(:list))
end

end
end

0 comments on commit 7922a01

Please sign in to comment.