Welcome to mirror list, hosted at ThFree Co, Russian Federation.

update_model_service_spec.rb « ml « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 35df62559e63a9656c30f7656a7a3da781977409 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ::Ml::UpdateModelService, feature_category: :mlops do
  let_it_be(:model) { create(:ml_models) }
  let_it_be(:description) { 'updated model description' }
  let(:service) { described_class.new(model, description) }

  describe '#execute' do
    context 'when supplied with a non-model object' do
      let(:model) { nil }

      it 'returns nil' do
        expect { service.execute }.to raise_error(NoMethodError)
      end
    end

    context 'with an existing model' do
      it 'updates the description' do
        updated = service.execute
        expect(updated.class).to be(Ml::Model)
        expect(updated.description).to eq(description)
      end
    end
  end
end