mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 17:51:13 +08:00
Merge branch 'mc-SCI-2704' of https://github.com/czbiohub/scinote-web-1 into czbiohub-mc-SCI-2704
Conflicts: spec/requests/api/v1/inventories_controller_spec.rb
This commit is contained in:
commit
548cfb65e1
1 changed files with 32 additions and 0 deletions
|
@ -254,4 +254,36 @@ RSpec.describe "Api::V1::InventoriesController", type: :request do
|
|||
expect(hash_body).to match({})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'DELETE inventories, #destroy' do
|
||||
it 'Destroys inventory' do
|
||||
deleted_id = @teams.first.repositories.last.id
|
||||
delete api_v1_team_inventory_path(
|
||||
id: deleted_id,
|
||||
team_id: @teams.first.id
|
||||
), headers: @valid_headers
|
||||
expect(response).to have_http_status(200)
|
||||
expect(Repository.where(id: deleted_id)).to_not exist
|
||||
expect(RepositoryRow.where(repository: deleted_id).count).to equal 0
|
||||
expect(RepositoryColumn.where(repository: deleted_id).count).to equal 0
|
||||
end
|
||||
|
||||
it 'Invalid request, non existing inventory' do
|
||||
delete api_v1_team_inventory_path(
|
||||
id: 123,
|
||||
team_id: @teams.first.id
|
||||
), headers: @valid_headers
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
|
||||
it 'When invalid request, repository from another team' do
|
||||
deleted_id = @teams.first.repositories.last.id
|
||||
delete api_v1_team_inventory_path(
|
||||
id: deleted_id,
|
||||
team_id: @teams.second.id
|
||||
), headers: @valid_headers
|
||||
expect(response).to have_http_status(403)
|
||||
expect(Repository.where(id: deleted_id)).to exist
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue