-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add manager to participation view (hitobito_jubla#78)
- Loading branch information
1 parent
951b9a4
commit ee88bb5
Showing
4 changed files
with
60 additions
and
28 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,57 @@ | ||
# Copyright (c) 2012-2013, Jungwacht Blauring Schweiz. This file is part of | ||
# hitobito 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. | ||
|
||
require "spec_helper" | ||
|
||
describe "event/participations/_attrs.html.haml" do | ||
let(:event) { EventDecorator.decorate(Fabricate(:course, groups: [groups(:top_layer)])) } | ||
let(:participation) { Fabricate(:event_participation, event: event) } | ||
subject(:dom) do | ||
render | ||
Capybara::Node::Simple.new(@rendered) | ||
end | ||
|
||
let(:params) do | ||
{"action" => "show", | ||
"controller" => "event/participations", | ||
"group_id" => "1", | ||
"event_id" => "36"} | ||
end | ||
|
||
before do | ||
assign(:event, event) | ||
assign(:group, event.groups.first.decorate) | ||
assign(:answers, []) | ||
allow(view).to receive_messages(parent: event) | ||
allow(view).to receive_messages(entry: participation.decorate) | ||
allow(view).to receive_messages(params: params) | ||
# allow(view).to receive_messages(current_person: people(:top_leader)) | ||
# Fabricate(event.participant_types.first.name, participation: participation) | ||
# participation.reload | ||
end | ||
|
||
context "with PeopleManager assigned" do | ||
let!(:manager) do | ||
Fabricate(:person).tap do |manager| | ||
manager.phone_numbers.create(number: "+41 44 123 45 57", label: "Privat") | ||
participation.person.managers << manager | ||
end | ||
end | ||
|
||
it "marks participations where required questions are unanswered" do | ||
login_as(people(:top_leader)) | ||
|
||
expect(dom).to have_text PeopleManager.model_name.human(count: 2) | ||
expect(dom).to have_text manager.to_s | ||
expect(dom).to have_text manager.email | ||
expect(dom).to have_text manager.phone_numbers.first | ||
end | ||
end | ||
|
||
def login_as(user) | ||
allow(controller).to receive_messages(current_user: user) | ||
allow(view).to receive_messages(current_user: user) | ||
end | ||
end |