Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SepsiLaszlo committed Dec 31, 2024
1 parent b149cae commit 53d111d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 19 additions & 1 deletion spec/policies/evaluation_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand All @@ -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) }
Expand Down Expand Up @@ -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) }
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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]) }

Expand Down
3 changes: 3 additions & 0 deletions spec/requests/evalutations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 53d111d

Please sign in to comment.