mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-03 03:03:04 +08:00
Merge pull request #3190 from aignatov-bio/ai-sci-5528-fix-tests
Fix tests [SCI-5528]
This commit is contained in:
commit
abdf3b32be
4 changed files with 8 additions and 4 deletions
|
@ -471,6 +471,8 @@ class Experiment < ApplicationRecord
|
|||
x_diff = my_modules.active.pluck(:x).min
|
||||
y_diff = my_modules.active.pluck(:y).min
|
||||
|
||||
return unless x_diff && y_diff
|
||||
|
||||
moving_direction = {
|
||||
x: x_diff.positive? ? :asc : :desc,
|
||||
y: y_diff.positive? ? :asc : :desc
|
||||
|
|
|
@ -33,10 +33,11 @@ module Experiments
|
|||
end
|
||||
|
||||
@exp.save!
|
||||
rescue
|
||||
@errors.merge!(@exp.errors.to_hash) unless @exp.valid?
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
|
||||
@errors.merge!(@exp.errors.to_hash) unless @exp.valid?
|
||||
|
||||
track_activity if succeed?
|
||||
self
|
||||
end
|
||||
|
|
|
@ -71,7 +71,7 @@ describe ExternalProtocolsController, type: :controller do
|
|||
|
||||
let(:action) { get :show, params: params }
|
||||
|
||||
let(:html_preview) { double('html_preview') }
|
||||
let(:html_preview) { double('html_preview', body: '<html></html>') }
|
||||
|
||||
before do
|
||||
allow(html_preview).to(receive(:as_json).and_return('<html></html>'))
|
||||
|
|
|
@ -205,12 +205,13 @@ describe ProjectsController, type: :controller do
|
|||
context 'in HTML format' do
|
||||
let(:params) do
|
||||
{ id: project_1.id,
|
||||
view_mode: :archived,
|
||||
project: { name: 'test project A1', team_id: team.id,
|
||||
visibility: 'visible' } }
|
||||
end
|
||||
|
||||
it 'returns success response' do
|
||||
get :experiment_archive, params: params
|
||||
get :show, params: params
|
||||
expect(response).to have_http_status(:success)
|
||||
expect(response.media_type).to eq 'text/html'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue