summaryrefslogtreecommitdiff
path: root/spec/lib/api
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 13:16:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 13:16:36 +0000
commit311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch)
tree07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/lib/api
parent27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff)
downloadgitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/lib/api')
-rw-r--r--spec/lib/api/ci/helpers/runner_spec.rb8
-rw-r--r--spec/lib/api/entities/projects/topic_spec.rb19
-rw-r--r--spec/lib/api/helpers_spec.rb2
3 files changed, 25 insertions, 4 deletions
diff --git a/spec/lib/api/ci/helpers/runner_spec.rb b/spec/lib/api/ci/helpers/runner_spec.rb
index cc871d66d40..37277e7dcbd 100644
--- a/spec/lib/api/ci/helpers/runner_spec.rb
+++ b/spec/lib/api/ci/helpers/runner_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe API::Ci::Helpers::Runner do
it 'handles sticking of a build when a build ID is specified' do
allow(helper).to receive(:params).and_return(id: build.id)
- expect(ApplicationRecord.sticking)
+ expect(Ci::Build.sticking)
.to receive(:stick_or_unstick_request)
.with({}, :build, build.id)
@@ -25,7 +25,7 @@ RSpec.describe API::Ci::Helpers::Runner do
it 'does not handle sticking if no build ID was specified' do
allow(helper).to receive(:params).and_return({})
- expect(ApplicationRecord.sticking)
+ expect(Ci::Build.sticking)
.not_to receive(:stick_or_unstick_request)
helper.current_job
@@ -44,7 +44,7 @@ RSpec.describe API::Ci::Helpers::Runner do
it 'handles sticking of a runner if a token is specified' do
allow(helper).to receive(:params).and_return(token: runner.token)
- expect(ApplicationRecord.sticking)
+ expect(Ci::Runner.sticking)
.to receive(:stick_or_unstick_request)
.with({}, :runner, runner.token)
@@ -54,7 +54,7 @@ RSpec.describe API::Ci::Helpers::Runner do
it 'does not handle sticking if no token was specified' do
allow(helper).to receive(:params).and_return({})
- expect(ApplicationRecord.sticking)
+ expect(Ci::Runner.sticking)
.not_to receive(:stick_or_unstick_request)
helper.current_runner
diff --git a/spec/lib/api/entities/projects/topic_spec.rb b/spec/lib/api/entities/projects/topic_spec.rb
new file mode 100644
index 00000000000..cdf142dbb7d
--- /dev/null
+++ b/spec/lib/api/entities/projects/topic_spec.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe API::Entities::Projects::Topic do
+ let(:topic) { create(:topic) }
+
+ subject { described_class.new(topic).as_json }
+
+ it 'exposes correct attributes' do
+ expect(subject).to include(
+ :id,
+ :name,
+ :description,
+ :total_projects_count,
+ :avatar_url
+ )
+ end
+end
diff --git a/spec/lib/api/helpers_spec.rb b/spec/lib/api/helpers_spec.rb
index 37e040a422b..2277bd78e86 100644
--- a/spec/lib/api/helpers_spec.rb
+++ b/spec/lib/api/helpers_spec.rb
@@ -351,12 +351,14 @@ RSpec.describe API::Helpers do
let(:send_git_blob) do
subject.send(:send_git_blob, repository, blob)
+ subject.header
end
before do
allow(subject).to receive(:env).and_return({})
allow(subject).to receive(:content_type)
allow(subject).to receive(:header).and_return({})
+ allow(subject).to receive(:body).and_return('')
allow(Gitlab::Workhorse).to receive(:send_git_blob)
end