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

update_model_version_service_spec.rb « model_versions « ml « services « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 99ea8b81df3c32754eb75e62061f5a707a5b4dcc (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Ml::ModelVersions::UpdateModelVersionService, feature_category: :mlops do
  let_it_be(:existing_version) { create(:ml_model_versions) }

  let(:project) { existing_version.project }
  let(:name) { existing_version.name }
  let(:version) { existing_version.version }
  let(:description) { 'A model version description' }

  subject(:execute_service) { described_class.new(project, name, version, description).execute }

  describe '#execute' do
    context 'when model version exists' do
      it { is_expected.to be_success }

      it 'updates the model version description' do
        execute_service

        expect(execute_service.payload.description).to eq(description)
      end
    end

    context 'when description is invalid' do
      let(:description) { 'a' * 501 }

      it { is_expected.to be_error }
    end

    context 'when model does not exist' do
      let(:name) { 'a_new_model' }

      it { is_expected.to be_error }
    end

    context 'when model version does not exist' do
      let(:name) { '2.0.0' }

      it { is_expected.to be_error }
    end
  end
end