Remove design registry entries

parent 9dce871d
......@@ -35,8 +35,9 @@ module Geo
# rubocop: disable CodeReuse/ActiveRecord
def destroy_registry_entries
::Geo::ProjectRegistry.where(project_id: id).delete_all
::Geo::DesignRegistry.where(project_id: id).delete_all
log_info("Project registry entry removed", project_id: id)
log_info("Registry entries removed", project_id: id)
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -54,10 +54,14 @@ describe Geo::RepositoryDestroyService do
service.execute
end
it 'removes the tracking entry' do
it 'removes the tracking entries' do
create(:geo_project_registry, project: project)
create(:geo_design_registry, project: project)
expect { service.execute }.to change(Geo::ProjectRegistry, :count).by(-1)
service.execute
expect(Geo::ProjectRegistry.where(project: project)).to be_empty
expect(Geo::DesignRegistry.where(project: project)).to be_empty
end
end
......@@ -92,10 +96,14 @@ describe Geo::RepositoryDestroyService do
service.execute
end
it 'removes the tracking entry' do
it 'removes the tracking entries' do
create(:geo_project_registry, project: project)
create(:geo_design_registry, project: project)
expect { service.execute }.to change(Geo::ProjectRegistry, :count).by(-1)
service.execute
expect(Geo::ProjectRegistry.where(project: project)).to be_empty
expect(Geo::DesignRegistry.where(project: project)).to be_empty
end
end
......@@ -110,12 +118,14 @@ describe Geo::RepositoryDestroyService do
service.execute
end
it 'removes the tracking entry' do
it 'removes the tracking entries' do
create(:geo_project_registry, project: project)
create(:geo_design_registry, project: project)
expect { service.execute }.to raise_error RuntimeError, 'storage not found: "broken"'
expect(Geo::ProjectRegistry.where(project: project)).to be_empty
expect(Geo::DesignRegistry.where(project: project)).to be_empty
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment