From 53d111da2a503f0430e1998e34edad81c9b26861 Mon Sep 17 00:00:00 2001 From: SepsiLaszlo Date: Tue, 31 Dec 2024 14:49:57 +0100 Subject: [PATCH] fix tests --- spec/policies/evaluation_policy_spec.rb | 20 ++++++++++++++++++- spec/requests/evalutations_controller_spec.rb | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/spec/policies/evaluation_policy_spec.rb b/spec/policies/evaluation_policy_spec.rb index c067c9aa..2fb59da9 100644 --- a/spec/policies/evaluation_policy_spec.rb +++ b/spec/policies/evaluation_policy_spec.rb @@ -76,6 +76,9 @@ context 'and the user is a leader of another group in the resort' do let(:user) { evaluation.group.parent.children.select { |g| g != evaluation.group }.first.leader.user } + before do + evaluation.group.parent.update!(id: Group::SIMONYI_ID) + end it { is_expected.to permit_actions(evaluation_view_actions) } it { is_expected.to forbid_actions(all_action - evaluation_view_actions) } @@ -93,6 +96,9 @@ context 'and the user is the leader of the group resort' do let(:user) { evaluation.group.parent.leader.user } + before do + evaluation.group.parent.update!(id: Group::SIMONYI_ID) + end it { is_expected.to permit_actions(evaluation_view_actions) } it { is_expected.to forbid_actions(all_action - evaluation_view_actions) } @@ -120,6 +126,9 @@ group == evaluation.group end.first.leader.user end + before do + evaluation.group.parent.update!(id: Group::SIMONYI_ID) + end it { is_expected.to permit_actions(evaluation_view_actions) } it { is_expected.to forbid_actions(all_action - evaluation_view_actions) } @@ -129,6 +138,9 @@ let(:user) do evaluation.group.parent.memberships.select(&:evaluation_helper?).first.user end + before do + evaluation.group.parent.update!(id: Group::SIMONYI_ID) + end it { is_expected.to permit_action(:show) } end @@ -138,6 +150,10 @@ evaluation.group.leader.user end + before do + evaluation.group.parent.update!(id: Group::SIMONYI_ID) + end + let(:resort_evaluation) do new_evaluation = Evaluation.new.set_default_values new_evaluation.group = evaluation.group.parent @@ -209,7 +225,9 @@ context "when the user is the resort leader" do let(:user) { evaluation.group.parent.leader.user } - + before do + evaluation.group.parent.update!(id: Group::SIMONYI_ID) + end it { is_expected.to permit_actions(update_request_actions + evaluation_view_actions + [:edit_justification]) } it { is_expected.to forbid_actions(all_action - (update_request_actions + evaluation_view_actions) - [:edit_justification]) } diff --git a/spec/requests/evalutations_controller_spec.rb b/spec/requests/evalutations_controller_spec.rb index cfe6ecb9..3cfad4ef 100644 --- a/spec/requests/evalutations_controller_spec.rb +++ b/spec/requests/evalutations_controller_spec.rb @@ -48,6 +48,9 @@ context 'when the user is the resort leader' do include_context "application season" let(:user) { group.parent.leader.user } + before do + evaluation.group.parent.update!(id: Group::SIMONYI_ID) + end before(:each) { login_as(user) } it 'creates new evaluation' do