Skip to content

Commit

Permalink
Update share controller spec to no longer account for enterprise
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-contreras committed Jul 11, 2024
1 parent cf3ebd4 commit 3ba40d8
Showing 1 changed file with 3 additions and 42 deletions.
45 changes: 3 additions & 42 deletions spec/controllers/shares_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@
allow(controller).to receive(:render).and_call_original
end

context "when the strategy does not allow viewing or managing but enterprise check succeeds",
with_ee: %i[work_package_sharing] do
context "when the strategy does not allow viewing or managing" do
let(:strategy) do
instance_double(SharingStrategies::ProjectQueryStrategy,
viewable?: false, manageable?: false,
Expand All @@ -191,26 +190,7 @@
end
end

context "when the strategy allows viewing but enterprise check fails" do
let(:strategy) do
instance_double(SharingStrategies::ProjectQueryStrategy,
viewable?: true, manageable?: false,
query: project_query)
end

before do
allow(SharingStrategies::ProjectQueryStrategy).to receive(:new).and_return(strategy)
end

it "renders the upsale component" do
make_request
expect(response).to have_http_status(:ok)
expect(controller).to have_received(:render).with(an_instance_of(Shares::ModalUpsaleComponent))
end
end

context "when the strategy allows viewing and enterprise check passes",
with_ee: %i[work_package_sharing] do
context "when the strategy allows viewing" do
before do
# Since this goes through and renders, we only care about
# stubbing permission related methods
Expand All @@ -228,26 +208,7 @@
end
end

context "when the strategy allows managing but enterprise check fails" do
let(:strategy) do
instance_double(SharingStrategies::ProjectQueryStrategy,
viewable?: false, manageable?: true,
query: project_query)
end

before do
allow(SharingStrategies::ProjectQueryStrategy).to receive(:new).and_return(strategy)
end

it "renders the upsale component" do
make_request
expect(response).to have_http_status(:ok)
expect(controller).to have_received(:render).with(an_instance_of(Shares::ModalUpsaleComponent))
end
end

context "when the strategy allows managing and enterprise check passes",
with_ee: %i[work_package_sharing] do
context "when the strategy allows managing" do
before do
# Since this goes through and renders, we only care about
# stubbing permission related methods
Expand Down

0 comments on commit 3ba40d8

Please sign in to comment.