Merge pull request #3190 from aignatov-bio/ai-sci-5528-fix-tests

Fix tests [SCI-5528]
This commit is contained in:
aignatov-bio 2021-03-01 10:06:33 +01:00 committed by GitHub
commit abdf3b32be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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>'))

View file

@ -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