Skip to content

Commit

Permalink
Return vpc peering when deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
brunograsselli committed May 16, 2024
1 parent cf86a1c commit bbb01b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/droplet_kit/resources/vpc_peering_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class VPCPeeringResource < ResourceKit::Resource
end

action :delete, 'DELETE /v2/vpc_peerings/:id' do
handler(202) { |_| true }
handler(202) { |response| VPCPeeringMapping.extract_single(response.body, :read) }
end
end

Expand Down
15 changes: 8 additions & 7 deletions spec/lib/droplet_kit/resources/vpc_peering_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
end
end

context 'when creating, updating and patching' do
context 'when creating, updating, patching, and deleting' do
let(:vpc_peering) do
DropletKit::VPCPeering.new(
name: 'example-vpc-peering'
Expand Down Expand Up @@ -105,14 +105,15 @@
let(:arguments) { DropletKit::VPCPeering.new }
end
end
end

describe '#delete' do
it 'sends a delete request for the vpc' do
request = stub_do_api(File.join(base_path, vpc_peering_uuid), :delete)
resource.delete(id: vpc_peering_uuid)
describe '#delete' do
let(:path) { base_path }

it 'returns vpc peering pending deletion' do
stub_do_api(File.join(base_path, vpc_peering_uuid), :delete).to_return(body: api_fixture(vpc_peering_fixture_path), status: 202)

expect(request).to have_been_made
expect(resource.delete(id: vpc_peering_uuid)).to match_vpc_peering_fixture
end
end
end
end

0 comments on commit bbb01b4

Please sign in to comment.