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-04-28 06:09:53 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-28 06:09:53 +0300
commit2e4d8b3449e8c2c750a816b9566c61a0a96b934b (patch)
tree831b4d55a3b283e519a4c911e444564d4c7c3344 /spec
parent56df7f06f1e57d66efcff5d8ad0026252cc91192 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/instrumentation_helper_spec.rb6
-rw-r--r--spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb4
-rw-r--r--spec/lib/gitlab/utils_spec.rb7
-rw-r--r--spec/requests/api/settings_spec.rb10
-rw-r--r--spec/rubocop/cop/api/grape_api_instance_spec.rb31
-rw-r--r--spec/rubocop/cop/api/grape_array_missing_coerce_spec.rb64
-rw-r--r--spec/rubocop/cop/code_reuse/worker_spec.rb2
7 files changed, 13 insertions, 111 deletions
diff --git a/spec/lib/gitlab/instrumentation_helper_spec.rb b/spec/lib/gitlab/instrumentation_helper_spec.rb
index 858fa044a52..fdb842dac0f 100644
--- a/spec/lib/gitlab/instrumentation_helper_spec.rb
+++ b/spec/lib/gitlab/instrumentation_helper_spec.rb
@@ -49,12 +49,12 @@ describe Gitlab::InstrumentationHelper do
describe '.queue_duration_for_job' do
where(:enqueued_at, :created_at, :time_now, :expected_duration) do
"2019-06-01T00:00:00.000+0000" | nil | "2019-06-01T02:00:00.000+0000" | 2.hours.to_f
- "2019-06-01T02:00:00.000+0000" | nil | "2019-06-01T02:00:00.001+0000" | 0.0
+ "2019-06-01T02:00:00.000+0000" | nil | "2019-06-01T02:00:00.001+0000" | 0.001
"2019-06-01T02:00:00.000+0000" | "2019-05-01T02:00:00.000+0000" | "2019-06-01T02:00:01.000+0000" | 1
- nil | "2019-06-01T02:00:00.000+0000" | "2019-06-01T02:00:00.001+0000" | 0.0
+ nil | "2019-06-01T02:00:00.000+0000" | "2019-06-01T02:00:00.001+0000" | 0.001
nil | nil | "2019-06-01T02:00:00.001+0000" | nil
"2019-06-01T02:00:00.000+0200" | nil | "2019-06-01T02:00:00.000-0200" | 4.hours.to_f
- 1571825569.998168 | nil | "2019-10-23T12:13:16.000+0200" | 26.00
+ 1571825569.998168 | nil | "2019-10-23T12:13:16.000+0200" | 26.001832
1571825569 | nil | "2019-10-23T12:13:16.000+0200" | 27
"invalid_date" | nil | "2019-10-23T12:13:16.000+0200" | nil
"" | nil | "2019-10-23T12:13:16.000+0200" | nil
diff --git a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
index f4b939c3013..4a1c046a603 100644
--- a/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
+++ b/spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb
@@ -44,7 +44,7 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
'job_status' => 'done',
'duration_s' => 0.0,
'completed_at' => timestamp.to_f,
- 'cpu_s' => 1.11,
+ 'cpu_s' => 1.111112,
'db_duration_s' => 0.0
)
end
@@ -224,7 +224,7 @@ describe Gitlab::SidekiqLogging::StructuredLogger do
let(:time) { { duration: 0.1231234, cputime: 1.2342345 } }
let(:payload) { { 'class' => 'my-class', 'message' => 'my-message', 'job_status' => 'my-job-status' } }
let(:current_utc_time) { Time.now.utc }
- let(:payload_with_time_keys) { { 'class' => 'my-class', 'message' => 'my-message', 'job_status' => 'my-job-status', 'duration_s' => 0.12, 'cpu_s' => 1.23, 'completed_at' => current_utc_time.to_f } }
+ let(:payload_with_time_keys) { { 'class' => 'my-class', 'message' => 'my-message', 'job_status' => 'my-job-status', 'duration_s' => 0.123123, 'cpu_s' => 1.234235, 'completed_at' => current_utc_time.to_f } }
subject { described_class.new }
diff --git a/spec/lib/gitlab/utils_spec.rb b/spec/lib/gitlab/utils_spec.rb
index e34367cbbf9..2416fb20151 100644
--- a/spec/lib/gitlab/utils_spec.rb
+++ b/spec/lib/gitlab/utils_spec.rb
@@ -59,9 +59,10 @@ describe Gitlab::Utils do
using RSpec::Parameterized::TableSyntax
where(:original, :expected) do
- 1999.8999 | 2
- 12384 | 12.38
- 333 | 0.33
+ 1999.8999 | 1.9999
+ 12384 | 12.384
+ 333 | 0.333
+ 1333.33333333 | 1.333333
end
with_them do
diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb
index 95d64ee8124..07e7a48d8c4 100644
--- a/spec/requests/api/settings_spec.rb
+++ b/spec/requests/api/settings_spec.rb
@@ -60,14 +60,14 @@ describe API::Settings, 'Settings' do
default_projects_limit: 3,
default_project_creation: 2,
password_authentication_enabled_for_web: false,
- repository_storages: 'custom',
+ repository_storages: ['custom'],
plantuml_enabled: true,
plantuml_url: 'http://plantuml.example.com',
sourcegraph_enabled: true,
sourcegraph_url: 'https://sourcegraph.com',
sourcegraph_public_only: false,
default_snippet_visibility: 'internal',
- restricted_visibility_levels: 'public',
+ restricted_visibility_levels: ['public'],
default_artifacts_expire_in: '2 days',
help_page_text: 'custom help text',
help_page_hide_commercial_content: true,
@@ -89,9 +89,7 @@ describe API::Settings, 'Settings' do
push_event_hooks_limit: 2,
push_event_activities_limit: 2,
snippet_size_limit: 5,
- issues_create_limit: 300,
- disabled_oauth_sign_in_sources: 'unknown',
- import_sources: 'github,bitbucket'
+ issues_create_limit: 300
}
expect(response).to have_gitlab_http_status(:ok)
@@ -129,8 +127,6 @@ describe API::Settings, 'Settings' do
expect(json_response['push_event_activities_limit']).to eq(2)
expect(json_response['snippet_size_limit']).to eq(5)
expect(json_response['issues_create_limit']).to eq(300)
- expect(json_response['disabled_oauth_sign_in_sources']).to eq([])
- expect(json_response['import_sources']).to match_array(%w(github bitbucket))
end
end
diff --git a/spec/rubocop/cop/api/grape_api_instance_spec.rb b/spec/rubocop/cop/api/grape_api_instance_spec.rb
deleted file mode 100644
index 0199377f104..00000000000
--- a/spec/rubocop/cop/api/grape_api_instance_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-require 'fast_spec_helper'
-require 'rubocop'
-require_relative '../../../support/helpers/expect_offense'
-require_relative '../../../../rubocop/cop/api/grape_api_instance'
-
-describe RuboCop::Cop::API::GrapeAPIInstance do
- include CopHelper
- include ExpectOffense
-
- subject(:cop) { described_class.new }
-
- it 'adds an offense when inheriting from Grape::API' do
- inspect_source(<<~CODE.strip_indent)
- class SomeAPI < Grape::API
- end
- CODE
-
- expect(cop.offenses.size).to eq(1)
- end
-
- it 'does not add an offense when inheriting from Grape::API::Instance' do
- inspect_source(<<~CODE.strip_indent)
- class SomeAPI < Grape::API::Instance
- end
- CODE
-
- expect(cop.offenses.size).to be_zero
- end
-end
diff --git a/spec/rubocop/cop/api/grape_array_missing_coerce_spec.rb b/spec/rubocop/cop/api/grape_array_missing_coerce_spec.rb
deleted file mode 100644
index 8252e07837d..00000000000
--- a/spec/rubocop/cop/api/grape_array_missing_coerce_spec.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-# frozen_string_literal: true
-
-require 'fast_spec_helper'
-require 'rubocop'
-require_relative '../../../support/helpers/expect_offense'
-require_relative '../../../../rubocop/cop/api/grape_array_missing_coerce'
-
-describe RuboCop::Cop::API::GrapeArrayMissingCoerce do
- include CopHelper
- include ExpectOffense
-
- subject(:cop) { described_class.new }
-
- it 'adds an offense with a required parameter' do
- inspect_source(<<~CODE.strip_indent)
- class SomeAPI < Grape::API::Instance
- params do
- requires :values, type: Array[String]
- end
- end
- CODE
-
- expect(cop.offenses.size).to eq(1)
- end
-
- it 'adds an offense with an optional parameter' do
- inspect_source(<<~CODE.strip_indent)
- class SomeAPI < Grape::API::Instance
- params do
- optional :values, type: Array[String]
- end
- end
- CODE
-
- expect(cop.offenses.size).to eq(1)
- end
-
- it 'does not add an offense' do
- inspect_source(<<~CODE.strip_indent)
- class SomeAPI < Grape::API::Instance
- params do
- requires :values, type: Array[String], coerce_with: ->(val) { val.split(',').map(&:strip) }
- requires :milestone, type: String, desc: 'Milestone title'
- optional :assignee_id, types: [Integer, String], integer_none_any: true,
- desc: 'Return issues which are assigned to the user with the given ID'
- end
- end
- CODE
-
- expect(cop.offenses.size).to be_zero
- end
-
- it 'does not add an offense for unrelated classes' do
- inspect_source(<<~CODE.strip_indent)
- class SomeClass
- params do
- requires :values, type: Array[String]
- end
- end
- CODE
-
- expect(cop.offenses.size).to be_zero
- end
-end
diff --git a/spec/rubocop/cop/code_reuse/worker_spec.rb b/spec/rubocop/cop/code_reuse/worker_spec.rb
index 9005b5a0611..97acaeb7643 100644
--- a/spec/rubocop/cop/code_reuse/worker_spec.rb
+++ b/spec/rubocop/cop/code_reuse/worker_spec.rb
@@ -31,7 +31,7 @@ describe RuboCop::Cop::CodeReuse::Worker do
.and_return(true)
expect_offense(<<~SOURCE)
- class Foo < Grape::API::Instance
+ class Foo < Grape::API
resource :projects do
get '/' do
FooWorker.perform_async