diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-08 06:15:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-08 06:15:41 +0300 |
commit | 777ef5e9b2cb049db6c25867d8321a191cec8f72 (patch) | |
tree | 8e2458bdde3047bb367e99e9d7de9862107e6212 /spec/presenters | |
parent | 6352d2f7c2a9e62e07f854861f9f57dacbd6f4a4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/presenters')
-rw-r--r-- | spec/presenters/ml/candidate_details_presenter_spec.rb | 9 | ||||
-rw-r--r-- | spec/presenters/ml/candidate_presenter_spec.rb | 21 |
2 files changed, 26 insertions, 4 deletions
diff --git a/spec/presenters/ml/candidate_details_presenter_spec.rb b/spec/presenters/ml/candidate_details_presenter_spec.rb index b89aaedb9ba..98b152f727c 100644 --- a/spec/presenters/ml/candidate_details_presenter_spec.rb +++ b/spec/presenters/ml/candidate_details_presenter_spec.rb @@ -3,11 +3,12 @@ require 'spec_helper' RSpec.describe ::Ml::CandidateDetailsPresenter, feature_category: :mlops do - let_it_be(:user) { create(:user, :with_avatar) } # rubocop:disable RSpec/FactoryBot/AvoidCreate - let_it_be(:project) { create(:project, :private, creator: user) } # rubocop:disable RSpec/FactoryBot/AvoidCreate - let_it_be(:experiment) { create(:ml_experiments, user: user, project: project) } # rubocop:disable RSpec/FactoryBot/AvoidCreate + let_it_be(:user) { build_stubbed(:user, :with_avatar) } + let_it_be(:project) { build_stubbed(:project, :private, creator: user) } + let_it_be(:experiment) { build_stubbed(:ml_experiments, user: user, project: project, iid: 100) } let_it_be(:candidate) do - create(:ml_candidates, :with_artifact, experiment: experiment, user: user, project: project) # rubocop:disable RSpec/FactoryBot/AvoidCreate + build_stubbed(:ml_candidates, :with_artifact, experiment: experiment, user: user, project: project, + internal_id: 100) end let_it_be(:pipeline) { build_stubbed(:ci_pipeline, project: project, user: user) } diff --git a/spec/presenters/ml/candidate_presenter_spec.rb b/spec/presenters/ml/candidate_presenter_spec.rb new file mode 100644 index 00000000000..f24b53d84e8 --- /dev/null +++ b/spec/presenters/ml/candidate_presenter_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Ml::CandidatePresenter, feature_category: :mlops do + let_it_be(:project) { build_stubbed(:project) } + let_it_be(:candidate) { build_stubbed(:ml_candidates, :with_artifact, internal_id: 1, project: project) } + let_it_be(:presenter) { candidate.present } + + describe '#path' do + subject { presenter.path } + + it { is_expected.to eq("/#{project.full_path}/-/ml/candidates/#{candidate.iid}") } + end + + describe '#artifact_path' do + subject { presenter.artifact_path } + + it { is_expected.to eq("/#{project.full_path}/-/packages/#{candidate.package_id}") } + end +end |