summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-06 21:08:48 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-06 21:08:48 +0000
commita89cb5cbdd832d4d9e80517973aceda6bc0a3856 (patch)
tree574475bd0901a2f8906d36a4728b8bbb95b41e1c /spec/lib
parent0d6fa033121a9bef708b8f2de186c4034c61d4a3 (diff)
downloadgitlab-ce-a89cb5cbdd832d4d9e80517973aceda6bc0a3856.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/container_registry/registry_spec.rb2
-rw-r--r--spec/lib/container_registry/tag_spec.rb18
-rw-r--r--spec/lib/gitlab/alerting/alert_spec.rb226
-rw-r--r--spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb2
-rw-r--r--spec/lib/gitlab/ci/trace/chunked_io_spec.rb18
-rw-r--r--spec/lib/gitlab/ci/trace/section_parser_spec.rb2
-rw-r--r--spec/lib/gitlab/cleanup/project_uploads_spec.rb4
-rw-r--r--spec/lib/gitlab/content_security_policy/config_loader_spec.rb4
-rw-r--r--spec/lib/gitlab/danger/teammate_spec.rb2
-rw-r--r--spec/lib/gitlab/database/count_spec.rb2
-rw-r--r--spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb2
-rw-r--r--spec/lib/gitlab/git_access_spec.rb2
-rw-r--r--spec/lib/gitlab/git_ref_validator_spec.rb4
-rw-r--r--spec/lib/gitlab/gpg_spec.rb4
-rw-r--r--spec/lib/gitlab/legacy_github_import/importer_spec.rb2
-rw-r--r--spec/lib/gitlab/private_commit_email_spec.rb8
-rw-r--r--spec/lib/gitlab/rugged_instrumentation_spec.rb2
-rw-r--r--spec/lib/gitlab/sanitizers/exif_spec.rb2
-rw-r--r--spec/lib/omni_auth/strategies/jwt_spec.rb2
-rw-r--r--spec/lib/safe_zip/entry_spec.rb4
-rw-r--r--spec/lib/safe_zip/extract_spec.rb2
21 files changed, 270 insertions, 44 deletions
diff --git a/spec/lib/container_registry/registry_spec.rb b/spec/lib/container_registry/registry_spec.rb
index 7cf70a1f562..e509566fae8 100644
--- a/spec/lib/container_registry/registry_spec.rb
+++ b/spec/lib/container_registry/registry_spec.rb
@@ -14,7 +14,7 @@ describe ContainerRegistry::Registry do
it { expect(subject).not_to be_nil }
- context '#path' do
+ describe '#path' do
subject { registry.path }
context 'path from URL' do
diff --git a/spec/lib/container_registry/tag_spec.rb b/spec/lib/container_registry/tag_spec.rb
index 9447112e4a8..085c73caa97 100644
--- a/spec/lib/container_registry/tag_spec.rb
+++ b/spec/lib/container_registry/tag_spec.rb
@@ -70,26 +70,26 @@ describe ContainerRegistry::Tag do
headers: { 'Content-Type' => 'application/vnd.docker.distribution.manifest.v1+prettyjws' })
end
- context '#layers' do
+ describe '#layers' do
subject { tag.layers }
it { expect(subject.length).to eq(1) }
end
- context '#total_size' do
+ describe '#total_size' do
subject { tag.total_size }
it { is_expected.to be_nil }
end
context 'config processing' do
- context '#config' do
+ describe '#config' do
subject { tag.config }
it { is_expected.to be_nil }
end
- context '#created_at' do
+ describe '#created_at' do
subject { tag.created_at }
it { is_expected.to be_nil }
@@ -113,7 +113,7 @@ describe ContainerRegistry::Tag do
body: File.read(Rails.root + 'spec/fixtures/container_registry/config_blob_helm.json'))
end
- context '#created_at' do
+ describe '#created_at' do
subject { tag.created_at }
it { is_expected.to be_nil }
@@ -130,13 +130,13 @@ describe ContainerRegistry::Tag do
headers: { 'Content-Type' => 'application/vnd.docker.distribution.manifest.v2+json' })
end
- context '#layers' do
+ describe '#layers' do
subject { tag.layers }
it { expect(subject.length).to eq(1) }
end
- context '#total_size' do
+ describe '#total_size' do
subject { tag.total_size }
it { is_expected.to eq(2319870) }
@@ -144,13 +144,13 @@ describe ContainerRegistry::Tag do
context 'config processing' do
shared_examples 'a processable' do
- context '#config' do
+ describe '#config' do
subject { tag.config }
it { is_expected.not_to be_nil }
end
- context '#created_at' do
+ describe '#created_at' do
subject { tag.created_at }
it { is_expected.not_to be_nil }
diff --git a/spec/lib/gitlab/alerting/alert_spec.rb b/spec/lib/gitlab/alerting/alert_spec.rb
new file mode 100644
index 00000000000..90e93d189e2
--- /dev/null
+++ b/spec/lib/gitlab/alerting/alert_spec.rb
@@ -0,0 +1,226 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Gitlab::Alerting::Alert do
+ let_it_be(:project) { create(:project) }
+
+ let(:alert) { build(:alerting_alert, project: project, payload: payload) }
+ let(:payload) { {} }
+
+ shared_context 'gitlab alert' do
+ let(:gitlab_alert_id) { gitlab_alert.prometheus_metric_id.to_s }
+ let!(:gitlab_alert) { create(:prometheus_alert, project: project) }
+
+ before do
+ payload['labels'] = { 'gitlab_alert_id' => gitlab_alert_id }
+ end
+ end
+
+ shared_examples 'invalid alert' do
+ it 'is invalid' do
+ expect(alert).not_to be_valid
+ end
+ end
+
+ shared_examples 'parse payload' do |*pairs|
+ context 'without payload' do
+ it { is_expected.to be_nil }
+ end
+
+ pairs.each do |pair|
+ context "with #{pair}" do
+ let(:value) { 'some value' }
+
+ before do
+ section, name = pair.split('/')
+ payload[section] = { name => value }
+ end
+
+ it { is_expected.to eq(value) }
+ end
+ end
+ end
+
+ describe '#gitlab_alert' do
+ subject { alert.gitlab_alert }
+
+ context 'without payload' do
+ it { is_expected.to be_nil }
+ end
+
+ context 'with gitlab alert' do
+ include_context 'gitlab alert'
+
+ it { is_expected.to eq(gitlab_alert) }
+ end
+
+ context 'with unknown gitlab alert' do
+ include_context 'gitlab alert' do
+ let(:gitlab_alert_id) { 'unknown' }
+ end
+
+ it { is_expected.to be_nil }
+ end
+ end
+
+ describe '#title' do
+ subject { alert.title }
+
+ it_behaves_like 'parse payload',
+ 'annotations/title',
+ 'annotations/summary',
+ 'labels/alertname'
+
+ context 'with gitlab alert' do
+ include_context 'gitlab alert'
+
+ context 'with annotations/title' do
+ let(:value) { 'annotation title' }
+
+ before do
+ payload['annotations'] = { 'title' => value }
+ end
+
+ it { is_expected.to eq(gitlab_alert.title) }
+ end
+ end
+ end
+
+ describe '#description' do
+ subject { alert.description }
+
+ it_behaves_like 'parse payload', 'annotations/description'
+ end
+
+ describe '#annotations' do
+ subject { alert.annotations }
+
+ context 'without payload' do
+ it { is_expected.to eq([]) }
+ end
+
+ context 'with payload' do
+ before do
+ payload['annotations'] = { 'foo' => 'value1', 'bar' => 'value2' }
+ end
+
+ it 'parses annotations' do
+ expect(subject.size).to eq(2)
+ expect(subject.map(&:label)).to eq(%w[foo bar])
+ expect(subject.map(&:value)).to eq(%w[value1 value2])
+ end
+ end
+ end
+
+ describe '#environment' do
+ subject { alert.environment }
+
+ context 'without gitlab_alert' do
+ it { is_expected.to be_nil }
+ end
+
+ context 'with gitlab alert' do
+ include_context 'gitlab alert'
+
+ it { is_expected.to eq(gitlab_alert.environment) }
+ end
+ end
+
+ describe '#starts_at' do
+ subject { alert.starts_at }
+
+ context 'with empty startsAt' do
+ before do
+ payload['startsAt'] = nil
+ end
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'with invalid startsAt' do
+ before do
+ payload['startsAt'] = 'invalid'
+ end
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'with payload' do
+ let(:time) { Time.now.change(usec: 0) }
+
+ before do
+ payload['startsAt'] = time.rfc3339
+ end
+
+ it { is_expected.to eq(time) }
+ end
+ end
+
+ describe '#full_query' do
+ using RSpec::Parameterized::TableSyntax
+
+ subject { alert.full_query }
+
+ where(:generator_url, :expected_query) do
+ nil | nil
+ 'http://localhost' | nil
+ 'invalid url' | nil
+ 'http://localhost:9090/graph?g1.expr=vector%281%29' | nil
+ 'http://localhost:9090/graph?g0.expr=vector%281%29' | 'vector(1)'
+ end
+
+ with_them do
+ before do
+ payload['generatorURL'] = generator_url
+ end
+
+ it { is_expected.to eq(expected_query) }
+ end
+
+ context 'with gitlab alert' do
+ include_context 'gitlab alert'
+
+ before do
+ payload['generatorURL'] = 'http://localhost:9090/graph?g0.expr=vector%281%29'
+ end
+
+ it { is_expected.to eq(gitlab_alert.full_query) }
+ end
+ end
+
+ describe '#alert_markdown' do
+ subject { alert.alert_markdown }
+
+ it_behaves_like 'parse payload', 'annotations/gitlab_incident_markdown'
+ end
+
+ describe '#valid?' do
+ before do
+ payload.update(
+ 'annotations' => { 'title' => 'some title' },
+ 'startsAt' => Time.now.rfc3339
+ )
+ end
+
+ subject { alert }
+
+ it { is_expected.to be_valid }
+
+ context 'without project' do
+ # Redefine to prevent:
+ # project is a NilClass - rspec-set works with ActiveRecord models only
+ let(:alert) { build(:alerting_alert, project: nil, payload: payload) }
+
+ it { is_expected.not_to be_valid }
+ end
+
+ context 'without starts_at' do
+ before do
+ payload['startsAt'] = nil
+ end
+
+ it { is_expected.not_to be_valid }
+ end
+ end
+end
diff --git a/spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb b/spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb
index 3605bac7dfc..10843a1435a 100644
--- a/spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb
+++ b/spec/lib/gitlab/ci/build/rules/rule/clause/exists_spec.rb
@@ -18,7 +18,7 @@ describe Gitlab::Ci::Build::Rules::Rule::Clause::Exists do
before do
stub_const('Gitlab::Ci::Build::Rules::Rule::Clause::Exists::MAX_PATTERN_COMPARISONS', 2)
- expect(File).to receive(:fnmatch?).exactly(2).times.and_call_original
+ expect(File).to receive(:fnmatch?).twice.and_call_original
end
it { is_expected.to be_truthy }
diff --git a/spec/lib/gitlab/ci/trace/chunked_io_spec.rb b/spec/lib/gitlab/ci/trace/chunked_io_spec.rb
index 795e8e51276..1b034656e7d 100644
--- a/spec/lib/gitlab/ci/trace/chunked_io_spec.rb
+++ b/spec/lib/gitlab/ci/trace/chunked_io_spec.rb
@@ -12,7 +12,7 @@ describe Gitlab::Ci::Trace::ChunkedIO, :clean_gitlab_redis_cache do
stub_feature_flags(ci_enable_live_trace: true)
end
- context "#initialize" do
+ describe "#initialize" do
context 'when a chunk exists' do
before do
build.trace.set('ABC')
@@ -35,7 +35,7 @@ describe Gitlab::Ci::Trace::ChunkedIO, :clean_gitlab_redis_cache do
end
end
- context "#seek" do
+ describe "#seek" do
subject { chunked_io.seek(pos, where) }
before do
@@ -66,7 +66,7 @@ describe Gitlab::Ci::Trace::ChunkedIO, :clean_gitlab_redis_cache do
end
end
- context "#eof?" do
+ describe "#eof?" do
subject { chunked_io.eof? }
before do
@@ -90,7 +90,7 @@ describe Gitlab::Ci::Trace::ChunkedIO, :clean_gitlab_redis_cache do
end
end
- context "#each_line" do
+ describe "#each_line" do
let(:string_io) { StringIO.new(sample_trace_raw) }
context 'when buffer size is smaller than file size' do
@@ -134,7 +134,7 @@ describe Gitlab::Ci::Trace::ChunkedIO, :clean_gitlab_redis_cache do
end
end
- context "#read" do
+ describe "#read" do
subject { chunked_io.read(length) }
context 'when read the whole size' do
@@ -254,7 +254,7 @@ describe Gitlab::Ci::Trace::ChunkedIO, :clean_gitlab_redis_cache do
end
end
- context "#readline" do
+ describe "#readline" do
subject { chunked_io.readline }
let(:string_io) { StringIO.new(sample_trace_raw) }
@@ -334,7 +334,7 @@ describe Gitlab::Ci::Trace::ChunkedIO, :clean_gitlab_redis_cache do
end
end
- context "#write" do
+ describe "#write" do
subject { chunked_io.write(data) }
let(:data) { sample_trace_raw }
@@ -399,7 +399,7 @@ describe Gitlab::Ci::Trace::ChunkedIO, :clean_gitlab_redis_cache do
end
end
- context "#truncate" do
+ describe "#truncate" do
let(:offset) { 10 }
context 'when data does not exist' do
@@ -432,7 +432,7 @@ describe Gitlab::Ci::Trace::ChunkedIO, :clean_gitlab_redis_cache do
end
end
- context "#destroy!" do
+ describe "#destroy!" do
subject { chunked_io.destroy! }
before do
diff --git a/spec/lib/gitlab/ci/trace/section_parser_spec.rb b/spec/lib/gitlab/ci/trace/section_parser_spec.rb
index 6e8504a1584..24ce4d34411 100644
--- a/spec/lib/gitlab/ci/trace/section_parser_spec.rb
+++ b/spec/lib/gitlab/ci/trace/section_parser_spec.rb
@@ -74,7 +74,7 @@ describe Gitlab::Ci::Trace::SectionParser do
let(:lines) { build_lines(trace) }
it 'must handle correctly byte positioning' do
- expect(subject).to receive(:find_next_marker).exactly(2).times.and_call_original
+ expect(subject).to receive(:find_next_marker).twice.and_call_original
subject.parse!
diff --git a/spec/lib/gitlab/cleanup/project_uploads_spec.rb b/spec/lib/gitlab/cleanup/project_uploads_spec.rb
index 5787cce7d20..d1e3a73686e 100644
--- a/spec/lib/gitlab/cleanup/project_uploads_spec.rb
+++ b/spec/lib/gitlab/cleanup/project_uploads_spec.rb
@@ -8,8 +8,8 @@ describe Gitlab::Cleanup::ProjectUploads do
let(:logger) { double(:logger) }
before do
- allow(logger).to receive(:info).at_least(1).times
- allow(logger).to receive(:debug).at_least(1).times
+ allow(logger).to receive(:info).at_least(:once)
+ allow(logger).to receive(:debug).at_least(:once)
end
describe '#run!' do
diff --git a/spec/lib/gitlab/content_security_policy/config_loader_spec.rb b/spec/lib/gitlab/content_security_policy/config_loader_spec.rb
index 1d404915617..bbbbf91bd44 100644
--- a/spec/lib/gitlab/content_security_policy/config_loader_spec.rb
+++ b/spec/lib/gitlab/content_security_policy/config_loader_spec.rb
@@ -19,7 +19,7 @@ describe Gitlab::ContentSecurityPolicy::ConfigLoader do
}
end
- context '.default_settings_hash' do
+ describe '.default_settings_hash' do
it 'returns empty defaults' do
settings = described_class.default_settings_hash
@@ -33,7 +33,7 @@ describe Gitlab::ContentSecurityPolicy::ConfigLoader do
end
end
- context '#load' do
+ describe '#load' do
subject { described_class.new(csp_config[:directives]) }
def expected_config(directive)
diff --git a/spec/lib/gitlab/danger/teammate_spec.rb b/spec/lib/gitlab/danger/teammate_spec.rb
index bf6152ff3c2..570f4bd27cc 100644
--- a/spec/lib/gitlab/danger/teammate_spec.rb
+++ b/spec/lib/gitlab/danger/teammate_spec.rb
@@ -176,7 +176,7 @@ describe Gitlab::Danger::Teammate do
it 'returns true if request fails' do
expect(Gitlab::Danger::RequestHelper).to receive(:http_get_json)
- .exactly(2).times
+ .twice
.and_raise(Gitlab::Danger::RequestHelper::HTTPError.new)
expect(subject.available?).to be true
diff --git a/spec/lib/gitlab/database/count_spec.rb b/spec/lib/gitlab/database/count_spec.rb
index 71c25f23b6b..2469ce482e7 100644
--- a/spec/lib/gitlab/database/count_spec.rb
+++ b/spec/lib/gitlab/database/count_spec.rb
@@ -10,7 +10,7 @@ describe Gitlab::Database::Count do
let(:models) { [Project, Identity] }
- context '.approximate_counts' do
+ describe '.approximate_counts' do
context 'fallbacks' do
subject { described_class.approximate_counts(models, strategies: strategies) }
diff --git a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb
index 1e9083950d0..300d7bb14b6 100644
--- a/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb
+++ b/spec/lib/gitlab/git/rugged_impl/use_rugged_spec.rb
@@ -31,7 +31,7 @@ describe Gitlab::Git::RuggedImpl::UseRugged, :seed_helper do
Gitlab::GitalyClient.instance_variable_set(:@can_use_disk, {})
end
- context '#execute_rugged_call', :request_store do
+ describe '#execute_rugged_call', :request_store do
let(:args) { ['refs/heads/master', 1] }
before do
diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb
index 231bcb4150c..0831021b22b 100644
--- a/spec/lib/gitlab/git_access_spec.rb
+++ b/spec/lib/gitlab/git_access_spec.rb
@@ -757,7 +757,7 @@ describe Gitlab::GitAccess do
allow(project).to receive(:lfs_enabled?).and_return(true)
expect_next_instance_of(Gitlab::Checks::LfsIntegrity) do |instance|
- expect(instance).to receive(:objects_missing?).exactly(1).times
+ expect(instance).to receive(:objects_missing?).once
end
push_access_check
diff --git a/spec/lib/gitlab/git_ref_validator_spec.rb b/spec/lib/gitlab/git_ref_validator_spec.rb
index 1531317c514..28cc13f02de 100644
--- a/spec/lib/gitlab/git_ref_validator_spec.rb
+++ b/spec/lib/gitlab/git_ref_validator_spec.rb
@@ -5,7 +5,7 @@ require 'spec_helper'
describe Gitlab::GitRefValidator do
using RSpec::Parameterized::TableSyntax
- context '.validate' do
+ describe '.validate' do
it { expect(described_class.validate('feature/new')).to be true }
it { expect(described_class.validate('implement_@all')).to be true }
it { expect(described_class.validate('my_new_feature')).to be true }
@@ -37,7 +37,7 @@ describe Gitlab::GitRefValidator do
it { expect(described_class.validate("\xA0\u0000\xB0")).to be false }
end
- context '.validate_merge_request_branch' do
+ describe '.validate_merge_request_branch' do
it { expect(described_class.validate_merge_request_branch('HEAD')).to be true }
it { expect(described_class.validate_merge_request_branch('feature/new')).to be true }
it { expect(described_class.validate_merge_request_branch('implement_@all')).to be true }
diff --git a/spec/lib/gitlab/gpg_spec.rb b/spec/lib/gitlab/gpg_spec.rb
index fac2dbfab71..c7b9775f642 100644
--- a/spec/lib/gitlab/gpg_spec.rb
+++ b/spec/lib/gitlab/gpg_spec.rb
@@ -215,8 +215,8 @@ describe Gitlab::Gpg do
end
it 'tries at least 2 times to remove the tmp dir before raising', :aggregate_failures do
- expect(Retriable).to receive(:sleep).at_least(2).times
- expect(FileUtils).to receive(:remove_entry).with(tmp_dir).at_least(2).times.and_raise('Deletion failed')
+ expect(Retriable).to receive(:sleep).at_least(:twice)
+ expect(FileUtils).to receive(:remove_entry).with(tmp_dir).at_least(:twice).and_raise('Deletion failed')
expect { described_class.using_tmp_keychain { } }.to raise_error(described_class::CleanupError)
end
diff --git a/spec/lib/gitlab/legacy_github_import/importer_spec.rb b/spec/lib/gitlab/legacy_github_import/importer_spec.rb
index c6ee0a3c094..7fef763f64d 100644
--- a/spec/lib/gitlab/legacy_github_import/importer_spec.rb
+++ b/spec/lib/gitlab/legacy_github_import/importer_spec.rb
@@ -205,7 +205,7 @@ describe Gitlab::LegacyGithubImport::Importer do
let(:gh_pull_request) { Gitlab::LegacyGithubImport::PullRequestFormatter.new(project, closed_pull_request) }
it 'does remove branches' do
- expect(subject).to receive(:remove_branch).at_least(2).times
+ expect(subject).to receive(:remove_branch).at_least(:twice)
subject.send(:clean_up_restored_branches, gh_pull_request)
end
end
diff --git a/spec/lib/gitlab/private_commit_email_spec.rb b/spec/lib/gitlab/private_commit_email_spec.rb
index 10bf624bbdd..7b7a0f7c0ca 100644
--- a/spec/lib/gitlab/private_commit_email_spec.rb
+++ b/spec/lib/gitlab/private_commit_email_spec.rb
@@ -8,7 +8,7 @@ describe Gitlab::PrivateCommitEmail do
let(:valid_email) { "#{id}-foo@#{hostname}" }
let(:invalid_email) { "#{id}-foo@users.noreply.bar.com" }
- context '.regex' do
+ describe '.regex' do
subject { described_class.regex }
it { is_expected.to match("1-foo@#{hostname}") }
@@ -18,7 +18,7 @@ describe Gitlab::PrivateCommitEmail do
it { is_expected.not_to match('foobar@gitlab.com') }
end
- context '.user_id_for_email' do
+ describe '.user_id_for_email' do
it 'parses user id from email' do
expect(described_class.user_id_for_email(valid_email)).to eq(id)
end
@@ -28,7 +28,7 @@ describe Gitlab::PrivateCommitEmail do
end
end
- context '.user_ids_for_email' do
+ describe '.user_ids_for_email' do
it 'returns deduplicated user IDs for each valid email' do
result = described_class.user_ids_for_emails([valid_email, valid_email, invalid_email])
@@ -41,7 +41,7 @@ describe Gitlab::PrivateCommitEmail do
end
end
- context '.for_user' do
+ describe '.for_user' do
it 'returns email in the format id-username@hostname' do
user = create(:user)
diff --git a/spec/lib/gitlab/rugged_instrumentation_spec.rb b/spec/lib/gitlab/rugged_instrumentation_spec.rb
index 4dcc8ae514a..64c0ce1b65e 100644
--- a/spec/lib/gitlab/rugged_instrumentation_spec.rb
+++ b/spec/lib/gitlab/rugged_instrumentation_spec.rb
@@ -15,7 +15,7 @@ describe Gitlab::RuggedInstrumentation, :request_store do
end
end
- context '.increment_query_count' do
+ describe '.increment_query_count' do
it 'tracks query counts' do
expect(subject.query_count).to eq(0)
diff --git a/spec/lib/gitlab/sanitizers/exif_spec.rb b/spec/lib/gitlab/sanitizers/exif_spec.rb
index 11e430e0be4..f0b733817b3 100644
--- a/spec/lib/gitlab/sanitizers/exif_spec.rb
+++ b/spec/lib/gitlab/sanitizers/exif_spec.rb
@@ -30,7 +30,7 @@ describe Gitlab::Sanitizers::Exif do
end
it 'processes only uploads created since specified date' do
- expect(sanitizer).to receive(:clean).exactly(2).times
+ expect(sanitizer).to receive(:clean).twice
sanitizer.batch_clean(since: 2.days.ago)
end
diff --git a/spec/lib/omni_auth/strategies/jwt_spec.rb b/spec/lib/omni_auth/strategies/jwt_spec.rb
index a8c565aa705..f2b682850e3 100644
--- a/spec/lib/omni_auth/strategies/jwt_spec.rb
+++ b/spec/lib/omni_auth/strategies/jwt_spec.rb
@@ -6,7 +6,7 @@ describe OmniAuth::Strategies::Jwt do
include Rack::Test::Methods
include DeviseHelpers
- context '#decoded' do
+ describe '#decoded' do
subject { described_class.new({}) }
let(:timestamp) { Time.now.to_i }
diff --git a/spec/lib/safe_zip/entry_spec.rb b/spec/lib/safe_zip/entry_spec.rb
index 0974f732188..be3d46917ee 100644
--- a/spec/lib/safe_zip/entry_spec.rb
+++ b/spec/lib/safe_zip/entry_spec.rb
@@ -25,13 +25,13 @@ describe SafeZip::Entry do
FileUtils.remove_entry_secure(target_path)
end
- context '#path_dir' do
+ describe '#path_dir' do
subject { entry.path_dir }
it { is_expected.to eq(target_path + '/public/folder') }
end
- context '#exist?' do
+ describe '#exist?' do
subject { entry.exist? }
context 'when entry does not exist' do
diff --git a/spec/lib/safe_zip/extract_spec.rb b/spec/lib/safe_zip/extract_spec.rb
index 3b8c64c1c9f..d388135c3fb 100644
--- a/spec/lib/safe_zip/extract_spec.rb
+++ b/spec/lib/safe_zip/extract_spec.rb
@@ -12,7 +12,7 @@ describe SafeZip::Extract do
FileUtils.remove_entry_secure(target_path)
end
- context '#extract' do
+ describe '#extract' do
subject { object.extract(directories: directories, to: target_path) }
shared_examples 'extracts archive' do |param|