Fix access to exercise-specific RfC listing

This commit is contained in:
Tobias Kantusch
2021-03-22 11:14:53 +00:00
committed by Sebastian Serth
parent 44b32b6f6a
commit 40d83dbb1d
12 changed files with 106 additions and 84 deletions

View File

@ -24,7 +24,7 @@ describe RequestForCommentsController do
rfc_other_study_group.user.update(study_groups: [another_study_group])
rfc_other_study_group.submission.update(study_group: another_study_group)
get :index, params: {"q[submission_study_group_id_in][]": my_study_group.id}
get :index, params: { "q[submission_study_group_id_in][]": my_study_group.id }
expect(assigns(:request_for_comments)).to eq([rfc_within_my_study_group])
end
@ -43,4 +43,14 @@ describe RequestForCommentsController do
expect_status(200)
expect_template(:index)
end
describe 'GET #get_rfcs_for_exercise' do
before do
exercise = FactoryBot.create(:even_odd)
get :get_rfcs_for_exercise, params: { exercise_id: exercise.id }
end
expect_status(200)
expect_template(:index)
end
end

View File

@ -14,7 +14,7 @@ let(:exercise) { FactoryBot.build(:dummy, public: true) }
end
end
[:create?, :index?, :new?, :statistics?, :feedback?, :requests_for_comments?].each do |action|
[:create?, :index?, :new?, :statistics?, :feedback?, :get_rfcs_for_exercise?].each do |action|
permissions(action) do
it 'grants access to admins' do
expect(subject).to permit(FactoryBot.build(:admin), exercise)