Skip to content

Commit b659428

Browse files
committed
Use leader participation for spec
1 parent 4a88804 commit b659428

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

spec/domain/export/tabular/people/participation_list_spec.rb

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
require "spec_helper"
99

1010
describe Export::Tabular::People::ParticipationsList do
11-
let(:event) { events(:top_course) }
12-
let(:participation) { event_participations(:top_participant) }
11+
let(:event) { participation.event }
12+
let(:participation) { event_participations(:top_leader) }
13+
let(:ability) { Ability.new(participation.person) }
14+
15+
subject(:attribute_labels) { described_class.new([participation], ability).attribute_labels }
1316

1417
describe "attribute_labels" do
1518
it "contains keys and translated labels" do
16-
attribute_labels = described_class.new([participation]).attribute_labels
17-
18-
expect(attribute_labels).to eq(
19+
expect(attribute_labels).to include(
1920
{
2021
first_name: "Vorname",
2122
last_name: "Nachname",
@@ -28,15 +29,10 @@
2829
end
2930

3031
context "event with question" do
31-
let(:question) {
32-
Fabricate(:event_question, event: event, question: "Vegi?")
33-
}
34-
3532
it "contains questions" do
36-
participation.answers.create! question: question, answer: "Ja"
37-
38-
attribute_labels = described_class.new([participation]).attribute_labels
39-
33+
question = Fabricate(:event_question, event: event, question: "Vegi?")
34+
expect(question.event).to eq participation.event
35+
participation.answers.find_by(question:).update!(answer: "Ja")
4036
expect(attribute_labels[:"question_#{question.id}"]).to eq("Vegi?")
4137
end
4238
end

0 commit comments

Comments
 (0)