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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-19 18:09:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-19 18:09:09 +0300
commitc7e385e282bcb8505589bce526e692b7bb819ffa (patch)
tree3e64affe1c2eebdcaa18cc6319b603f44b03b07e /spec
parentcd3e2c7b9355f8990ab294b34b5e4add4f3985fa (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/initializers/lograge_spec.rb2
-rw-r--r--spec/lib/gitlab/ci/yaml_processor_spec.rb22
-rw-r--r--spec/lib/gitlab/utils/log_limited_array_spec.rb22
-rw-r--r--spec/requests/groups/milestones_controller_spec.rb2
-rw-r--r--spec/requests/groups/registry/repositories_controller_spec.rb2
5 files changed, 43 insertions, 7 deletions
diff --git a/spec/initializers/lograge_spec.rb b/spec/initializers/lograge_spec.rb
index 15165c6db98..0068b894474 100644
--- a/spec/initializers/lograge_spec.rb
+++ b/spec/initializers/lograge_spec.rb
@@ -17,7 +17,7 @@ describe 'lograge', type: :request do
end
let(:limited_params) do
- large_params.slice(:a, :b).map { |k, v| { key: k.to_s, value: v } } + ['...']
+ large_params.slice(:a, :b).map { |k, v| { key: k.to_s, value: v } } + [{ key: 'truncated', value: '...' }]
end
context 'for API requests' do
diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb
index e5c5aaa2265..e81aeb620c3 100644
--- a/spec/lib/gitlab/ci/yaml_processor_spec.rb
+++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb
@@ -87,6 +87,28 @@ module Gitlab
end
end
+ describe 'tags entry with default values' do
+ it 'applies default values' do
+ config = YAML.dump({ default: { tags: %w[A B] },
+ rspec: { script: "rspec" } })
+
+ config_processor = Gitlab::Ci::YamlProcessor.new(config)
+
+ expect(config_processor.stage_builds_attributes("test").size).to eq(1)
+ expect(config_processor.stage_builds_attributes("test").first).to eq({
+ stage: "test",
+ stage_idx: 2,
+ name: "rspec",
+ only: { refs: %w[branches tags] },
+ options: { script: ["rspec"] },
+ tag_list: %w[A B],
+ allow_failure: false,
+ when: "on_success",
+ yaml_variables: []
+ })
+ end
+ end
+
describe 'interruptible entry' do
describe 'interruptible job' do
let(:config) do
diff --git a/spec/lib/gitlab/utils/log_limited_array_spec.rb b/spec/lib/gitlab/utils/log_limited_array_spec.rb
index 2729b2c7b6f..a236ab37614 100644
--- a/spec/lib/gitlab/utils/log_limited_array_spec.rb
+++ b/spec/lib/gitlab/utils/log_limited_array_spec.rb
@@ -18,12 +18,26 @@ describe Gitlab::Utils::LogLimitedArray do
end
context 'when the array exceeds the limit' do
- it 'replaces arguments after the limit with an ellipsis string' do
+ let(:long_array) do
half_limit = described_class::MAXIMUM_ARRAY_LENGTH / 2
- long_array = ['a' * half_limit, 'b' * half_limit, 'c']
- expect(described_class.log_limited_array(long_array))
- .to eq(long_array.take(1) + ['...'])
+ ['a' * half_limit, 'b' * half_limit, 'c']
+ end
+
+ context 'when no sentinel value is passed' do
+ it 'replaces arguments after the limit with an ellipsis string' do
+ expect(described_class.log_limited_array(long_array))
+ .to eq(long_array.take(1) + ['...'])
+ end
+ end
+
+ context 'when a sentinel value is passed' do
+ it 'replaces arguments after the limit with the sentinel' do
+ sentinel = { truncated: true }
+
+ expect(described_class.log_limited_array(long_array, sentinel: sentinel))
+ .to eq(long_array.take(1) + [sentinel])
+ end
end
end
diff --git a/spec/requests/groups/milestones_controller_spec.rb b/spec/requests/groups/milestones_controller_spec.rb
index 977cccad29f..4d15aa43cd2 100644
--- a/spec/requests/groups/milestones_controller_spec.rb
+++ b/spec/requests/groups/milestones_controller_spec.rb
@@ -24,7 +24,7 @@ describe Groups::MilestonesController do
end
expect { get "/groups/#{public_group.to_param}/-/milestones.json" }.not_to exceed_all_query_limit(control_count)
- expect(response).to have_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
milestones = json_response
expect(milestones.count).to eq(3)
diff --git a/spec/requests/groups/registry/repositories_controller_spec.rb b/spec/requests/groups/registry/repositories_controller_spec.rb
index 35fdeaab604..25bd7aa862e 100644
--- a/spec/requests/groups/registry/repositories_controller_spec.rb
+++ b/spec/requests/groups/registry/repositories_controller_spec.rb
@@ -28,7 +28,7 @@ describe Groups::Registry::RepositoriesController do
expect { get(endpoint) }.not_to exceed_all_query_limit(control_count)
# sanity check that response is 200
- expect(response).to have_http_status(200)
+ expect(response).to have_gitlab_http_status(:ok)
repositories = json_response
expect(repositories.count).to eq(5)
end