mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-02 13:12:13 +08:00
Merge pull request #3060 from urbanrotnik/ur-sci-fix-tests
Fix tests on develop
This commit is contained in:
commit
259c23e107
9 changed files with 6 additions and 78 deletions
|
@ -11,7 +11,7 @@ module Repositories
|
|||
|
||||
log_activity(:archive_inventory, repository)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotSaved
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
@errors[:archiving_error] = I18n.t('repositories.archive_inventories.unsuccess_flash')
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ module Repositories
|
|||
|
||||
log_activity(:restore_inventory, repository)
|
||||
end
|
||||
rescue ActiveRecord::RecordNotSaved
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
@errors[:restoring_error] = I18n.t('repositories.restore_inventories.unsuccess_flash')
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ module RepositoryActions
|
|||
row.archive!(@user)
|
||||
log_activity(:archive_inventory_item, row) if @log_activities
|
||||
end
|
||||
rescue ActiveRecord::RecordNotSaved
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
@errors[:archiving_error] = I18n.t('repositories.archive_records.unsuccess_flash', @repository.name)
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ module RepositoryActions
|
|||
row.restore!(@user)
|
||||
log_activity(:restore_inventory_item, row) if @log_activities
|
||||
end
|
||||
rescue ActiveRecord::RecordNotSaved
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
@errors[:restoring_error] = I18n.t('repositories.restore_records.unsuccess_flash', @repository.name)
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
|
|
|
@ -74,25 +74,6 @@ RSpec.describe 'Api::V1::ChecklistsController', type: :request do
|
|||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when experiment is archived and permission checks fails' do
|
||||
it 'renders 403' do
|
||||
@experiment.update_attribute(:archived, true)
|
||||
|
||||
get api_v1_team_project_experiment_task_protocol_step_path(
|
||||
team_id: @team.id,
|
||||
project_id: @project.id,
|
||||
experiment_id: @experiment.id,
|
||||
task_id: @task.id,
|
||||
protocol_id: @protocol.id,
|
||||
step_id: @step.id,
|
||||
checklist_id: @checklist.id,
|
||||
id: checklist_item.id
|
||||
), headers: @valid_headers
|
||||
|
||||
expect(response).to have_http_status(403)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST checklist_item, #create' do
|
||||
|
|
|
@ -70,24 +70,6 @@ RSpec.describe 'Api::V1::ChecklistsController', type: :request do
|
|||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when experiment is archived and permission checks fails' do
|
||||
it 'renders 403' do
|
||||
@experiment.update_attribute(:archived, true)
|
||||
|
||||
get api_v1_team_project_experiment_task_protocol_step_path(
|
||||
team_id: @team.id,
|
||||
project_id: @project.id,
|
||||
experiment_id: @experiment.id,
|
||||
task_id: @task.id,
|
||||
protocol_id: @protocol.id,
|
||||
step_id: @step.id,
|
||||
id: checklist.id
|
||||
), headers: @valid_headers
|
||||
|
||||
expect(response).to have_http_status(403)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST checklist, #create' do
|
||||
|
|
|
@ -79,23 +79,6 @@ RSpec.describe 'Api::V1::StepsController', type: :request do
|
|||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when experiment is archived and permission checks fails' do
|
||||
it 'renders 403' do
|
||||
@experiment.update_attribute(:archived, true)
|
||||
|
||||
get api_v1_team_project_experiment_task_protocol_step_path(
|
||||
team_id: @team.id,
|
||||
project_id: @project.id,
|
||||
experiment_id: @experiment.id,
|
||||
task_id: @task.id,
|
||||
protocol_id: protocol.id,
|
||||
id: steps.first.id
|
||||
), headers: @valid_headers
|
||||
|
||||
expect(response).to have_http_status(403)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST step, #create' do
|
||||
|
|
|
@ -70,24 +70,6 @@ RSpec.describe 'Api::V1::TablesController', type: :request do
|
|||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when experiment is archived and permission checks fails' do
|
||||
it 'renders 403' do
|
||||
@experiment.update_attribute(:archived, true)
|
||||
|
||||
get api_v1_team_project_experiment_task_protocol_step_table_path(
|
||||
team_id: @team.id,
|
||||
project_id: @project.id,
|
||||
experiment_id: @experiment.id,
|
||||
task_id: @task.id,
|
||||
protocol_id: @protocol.id,
|
||||
step_id: @step.id,
|
||||
id: table.id
|
||||
), headers: @valid_headers
|
||||
|
||||
expect(response).to have_http_status(403)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST table, #create' do
|
||||
|
|
|
@ -59,7 +59,7 @@ describe ProjectsOverviewService do
|
|||
end
|
||||
|
||||
context "with request parameters { filter: 'active' }" do
|
||||
let(:params) { { filter: 'active' } }
|
||||
let(:params) { { view_mode: 'active' } }
|
||||
|
||||
it 'returns all active projects' do
|
||||
projects = @projects_overview.project_cards
|
||||
|
@ -128,7 +128,7 @@ describe ProjectsOverviewService do
|
|||
end
|
||||
|
||||
context "with request parameters { filter: 'archived' }" do
|
||||
let(:params) { super().merge(filter: 'archived') }
|
||||
let(:params) { super().merge(view_mode: 'archived') }
|
||||
|
||||
it 'returns all archived projects' do
|
||||
projects = @projects_overview.project_cards
|
||||
|
|
Loading…
Reference in a new issue