Skip to content

Commit 86b6cce

Browse files
authored
Fix: Persist factory assignments of file for RfCs (#2924)
Associations created by a factory need to be persisted to avoid testing against an in memory object by mistake.
1 parent 5049926 commit 86b6cce

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

spec/factories/request_for_comment.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55
user factory: :external_user
66
exercise factory: :math
77
submission { association :submission, exercise:, user:, study_group: user&.study_groups&.first }
8-
file
8+
file { submission.files.first }
99
sequence :question do |n|
1010
"test question #{n}"
1111
end
1212

1313
factory :rfc_with_comment, class: 'RequestForComment' do
1414
after(:create) do |rfc|
15-
rfc.file = rfc.submission.files.first
1615
Comment.create(file: rfc.file, user: rfc.user, row: 1, text: "comment for rfc #{rfc.question}")
17-
rfc.submission.study_group_id = rfc.user.current_study_group_id
1816
end
1917
end
2018
end

0 commit comments

Comments
 (0)