mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-03 19:24:48 +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
|
x_diff = my_modules.active.pluck(:x).min
|
||||||
y_diff = my_modules.active.pluck(:y).min
|
y_diff = my_modules.active.pluck(:y).min
|
||||||
|
|
||||||
|
return unless x_diff && y_diff
|
||||||
|
|
||||||
moving_direction = {
|
moving_direction = {
|
||||||
x: x_diff.positive? ? :asc : :desc,
|
x: x_diff.positive? ? :asc : :desc,
|
||||||
y: y_diff.positive? ? :asc : :desc
|
y: y_diff.positive? ? :asc : :desc
|
||||||
|
|
|
@ -33,10 +33,11 @@ module Experiments
|
||||||
end
|
end
|
||||||
|
|
||||||
@exp.save!
|
@exp.save!
|
||||||
|
rescue
|
||||||
|
@errors.merge!(@exp.errors.to_hash) unless @exp.valid?
|
||||||
|
raise ActiveRecord::Rollback
|
||||||
end
|
end
|
||||||
|
|
||||||
@errors.merge!(@exp.errors.to_hash) unless @exp.valid?
|
|
||||||
|
|
||||||
track_activity if succeed?
|
track_activity if succeed?
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
|
@ -71,7 +71,7 @@ describe ExternalProtocolsController, type: :controller do
|
||||||
|
|
||||||
let(:action) { get :show, params: params }
|
let(:action) { get :show, params: params }
|
||||||
|
|
||||||
let(:html_preview) { double('html_preview') }
|
let(:html_preview) { double('html_preview', body: '<html></html>') }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(html_preview).to(receive(:as_json).and_return('<html></html>'))
|
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
|
context 'in HTML format' do
|
||||||
let(:params) do
|
let(:params) do
|
||||||
{ id: project_1.id,
|
{ id: project_1.id,
|
||||||
|
view_mode: :archived,
|
||||||
project: { name: 'test project A1', team_id: team.id,
|
project: { name: 'test project A1', team_id: team.id,
|
||||||
visibility: 'visible' } }
|
visibility: 'visible' } }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns success response' do
|
it 'returns success response' do
|
||||||
get :experiment_archive, params: params
|
get :show, params: params
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
expect(response.media_type).to eq 'text/html'
|
expect(response.media_type).to eq 'text/html'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue