diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-02-22 16:50:15 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-02-23 09:33:05 -0600 |
commit | 1fe7501b49f896b74102c4b970310aa9ae34da85 (patch) | |
tree | ce271afb0fbaaa14291c1dc9009cd7815ee25463 /spec/lib/gitlab | |
parent | bdbc7d967a0c3d95d5e4ea19a2a5be41268d3540 (diff) | |
download | gitlab-ce-1fe7501b49f896b74102c4b970310aa9ae34da85.tar.gz |
Revert "Prefer leading style for Style/DotPosition"
This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
Diffstat (limited to 'spec/lib/gitlab')
81 files changed, 627 insertions, 627 deletions
diff --git a/spec/lib/gitlab/asciidoc_spec.rb b/spec/lib/gitlab/asciidoc_spec.rb index bca57105d1d..e193a3b79a6 100644 --- a/spec/lib/gitlab/asciidoc_spec.rb +++ b/spec/lib/gitlab/asciidoc_spec.rb @@ -19,8 +19,8 @@ module Gitlab attributes: described_class::DEFAULT_ADOC_ATTRS } - expect(Asciidoctor).to receive(:convert) - .with(input, expected_asciidoc_opts).and_return(html) + expect(Asciidoctor).to receive(:convert). + with(input, expected_asciidoc_opts).and_return(html) expect( render(input, context) ).to eql html end @@ -35,8 +35,8 @@ module Gitlab attributes: described_class::DEFAULT_ADOC_ATTRS + ['foo'] } - expect(Asciidoctor).to receive(:convert) - .with(input, expected_asciidoc_opts).and_return(html) + expect(Asciidoctor).to receive(:convert). + with(input, expected_asciidoc_opts).and_return(html) render(input, context, asciidoc_opts) end diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb index b234de4c772..57c416fb35a 100644 --- a/spec/lib/gitlab/auth_spec.rb +++ b/spec/lib/gitlab/auth_spec.rb @@ -140,8 +140,8 @@ describe Gitlab::Auth, lib: true do password: 'my-secret', ) - expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')) - .to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities)) + expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')). + to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities)) end it 'falls through oauth authentication when the username is oauth2' do @@ -151,8 +151,8 @@ describe Gitlab::Auth, lib: true do password: 'my-secret', ) - expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')) - .to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities)) + expect(gl_auth.find_for_git_client(user.username, user.password, project: nil, ip: 'ip')). + to eq(Gitlab::Auth::Result.new(user, nil, :gitlab_or_ldap, full_authentication_abilities)) end end diff --git a/spec/lib/gitlab/backup/manager_spec.rb b/spec/lib/gitlab/backup/manager_spec.rb index f84782ab440..e9c69183d00 100644 --- a/spec/lib/gitlab/backup/manager_spec.rb +++ b/spec/lib/gitlab/backup/manager_spec.rb @@ -141,8 +141,8 @@ describe Backup::Manager, lib: true do it 'fails the operation and prints an error' do expect { subject.unpack }.to raise_error SystemExit - expect(progress).to have_received(:puts) - .with(a_string_matching('No backups found')) + expect(progress).to have_received(:puts). + with(a_string_matching('No backups found')) end end @@ -158,8 +158,8 @@ describe Backup::Manager, lib: true do it 'fails the operation and prints an error' do expect { subject.unpack }.to raise_error SystemExit - expect(progress).to have_received(:puts) - .with(a_string_matching('Found more than one backup')) + expect(progress).to have_received(:puts). + with(a_string_matching('Found more than one backup')) end end @@ -178,8 +178,8 @@ describe Backup::Manager, lib: true do it 'fails the operation and prints an error' do expect { subject.unpack }.to raise_error SystemExit expect(File).to have_received(:exist?).with('wrong_gitlab_backup.tar') - expect(progress).to have_received(:puts) - .with(a_string_matching('The backup file wrong_gitlab_backup.tar does not exist')) + expect(progress).to have_received(:puts). + with(a_string_matching('The backup file wrong_gitlab_backup.tar does not exist')) end end @@ -200,8 +200,8 @@ describe Backup::Manager, lib: true do it 'unpacks the file' do subject.unpack - expect(Kernel).to have_received(:system) - .with("tar", "-xf", "1451606400_2016_01_01_gitlab_backup.tar") + expect(Kernel).to have_received(:system). + with("tar", "-xf", "1451606400_2016_01_01_gitlab_backup.tar") expect(progress).to have_received(:puts).with(a_string_matching('done')) end end diff --git a/spec/lib/gitlab/badge/build/status_spec.rb b/spec/lib/gitlab/badge/build/status_spec.rb index 3c5414701a7..8a4bf4dc89b 100644 --- a/spec/lib/gitlab/badge/build/status_spec.rb +++ b/spec/lib/gitlab/badge/build/status_spec.rb @@ -20,8 +20,8 @@ describe Gitlab::Badge::Build::Status do describe '#metadata' do it 'returns badge metadata' do - expect(badge.metadata.image_url) - .to include 'badges/master/build.svg' + expect(badge.metadata.image_url). + to include 'badges/master/build.svg' end end diff --git a/spec/lib/gitlab/bitbucket_import/importer_spec.rb b/spec/lib/gitlab/bitbucket_import/importer_spec.rb index aceb6bf871c..1da145e7b68 100644 --- a/spec/lib/gitlab/bitbucket_import/importer_spec.rb +++ b/spec/lib/gitlab/bitbucket_import/importer_spec.rb @@ -86,11 +86,11 @@ describe Gitlab::BitbucketImport::Importer, lib: true do headers: { "Content-Type" => "application/json" }, body: issues_statuses_sample_data.to_json) - stub_request(:get, "https://api.bitbucket.org/2.0/repositories/namespace/repo?pagelen=50&sort=created_on") - .with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer', 'User-Agent' => 'Faraday v0.9.2' }) - .to_return(status: 200, - body: "", - headers: {}) + stub_request(:get, "https://api.bitbucket.org/2.0/repositories/namespace/repo?pagelen=50&sort=created_on"). + with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer', 'User-Agent' => 'Faraday v0.9.2' }). + to_return(status: 200, + body: "", + headers: {}) sample_issues_statuses.each_with_index do |issue, index| stub_request( diff --git a/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb b/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb index 6a52ae01b2f..eea01f91879 100644 --- a/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb +++ b/spec/lib/gitlab/ci/build/artifacts/metadata_spec.rb @@ -33,8 +33,8 @@ describe Gitlab::Ci::Build::Artifacts::Metadata do subject { metadata('other_artifacts_0.1.2/').find_entries! } it 'matches correct paths' do - expect(subject.keys) - .to contain_exactly 'other_artifacts_0.1.2/', + expect(subject.keys). + to contain_exactly 'other_artifacts_0.1.2/', 'other_artifacts_0.1.2/doc_sample.txt', 'other_artifacts_0.1.2/another-subdirectory/' end @@ -44,8 +44,8 @@ describe Gitlab::Ci::Build::Artifacts::Metadata do subject { metadata('other_artifacts_0.1.2/another-subdirectory/').find_entries! } it 'matches correct paths' do - expect(subject.keys) - .to contain_exactly 'other_artifacts_0.1.2/another-subdirectory/', + expect(subject.keys). + to contain_exactly 'other_artifacts_0.1.2/another-subdirectory/', 'other_artifacts_0.1.2/another-subdirectory/empty_directory/', 'other_artifacts_0.1.2/another-subdirectory/banana_sample.gif' end @@ -55,8 +55,8 @@ describe Gitlab::Ci::Build::Artifacts::Metadata do subject { metadata('other_artifacts_0.1.2/', recursive: true).find_entries! } it 'matches correct paths' do - expect(subject.keys) - .to contain_exactly 'other_artifacts_0.1.2/', + expect(subject.keys). + to contain_exactly 'other_artifacts_0.1.2/', 'other_artifacts_0.1.2/doc_sample.txt', 'other_artifacts_0.1.2/another-subdirectory/', 'other_artifacts_0.1.2/another-subdirectory/empty_directory/', diff --git a/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb b/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb index 5c31423fdee..987a0b1f67f 100644 --- a/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb @@ -26,8 +26,8 @@ describe Gitlab::Ci::Config::Entry::Artifacts do let(:config) { { name: 10 } } it 'reports error' do - expect(entry.errors) - .to include 'artifacts name should be a string' + expect(entry.errors). + to include 'artifacts name should be a string' end end @@ -35,8 +35,8 @@ describe Gitlab::Ci::Config::Entry::Artifacts do let(:config) { { test: 100 } } it 'reports error' do - expect(entry.errors) - .to include 'artifacts config contains unknown keys: test' + expect(entry.errors). + to include 'artifacts config contains unknown keys: test' end end end diff --git a/spec/lib/gitlab/ci/config/entry/attributable_spec.rb b/spec/lib/gitlab/ci/config/entry/attributable_spec.rb index fde03c51e2c..efb8c5adab1 100644 --- a/spec/lib/gitlab/ci/config/entry/attributable_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/attributable_spec.rb @@ -14,9 +14,9 @@ describe Gitlab::Ci::Config::Entry::Attributable do context 'config is a hash' do before do - allow(instance) - .to receive(:config) - .and_return({ name: 'some name', test: 'some test' }) + allow(instance). + to receive(:config). + and_return({ name: 'some name', test: 'some test' }) end it 'returns the value of config' do @@ -31,9 +31,9 @@ describe Gitlab::Ci::Config::Entry::Attributable do context 'config is not a hash' do before do - allow(instance) - .to receive(:config) - .and_return('some test') + allow(instance). + to receive(:config). + and_return('some test') end it 'returns nil' do diff --git a/spec/lib/gitlab/ci/config/entry/boolean_spec.rb b/spec/lib/gitlab/ci/config/entry/boolean_spec.rb index 5f067cad93c..8987c0549c5 100644 --- a/spec/lib/gitlab/ci/config/entry/boolean_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/boolean_spec.rb @@ -25,8 +25,8 @@ describe Gitlab::Ci::Config::Entry::Boolean do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'boolean config should be a boolean value' + expect(entry.errors). + to include 'boolean config should be a boolean value' end end end diff --git a/spec/lib/gitlab/ci/config/entry/cache_spec.rb b/spec/lib/gitlab/ci/config/entry/cache_spec.rb index 70a327c5183..e91f049ee72 100644 --- a/spec/lib/gitlab/ci/config/entry/cache_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/cache_spec.rb @@ -32,8 +32,8 @@ describe Gitlab::Ci::Config::Entry::Cache do let(:config) { 'ls' } it 'reports errors with config value' do - expect(entry.errors) - .to include 'cache config should be a hash' + expect(entry.errors). + to include 'cache config should be a hash' end end @@ -41,8 +41,8 @@ describe Gitlab::Ci::Config::Entry::Cache do let(:config) { { key: 1 } } it 'reports error with descendants' do - expect(entry.errors) - .to include 'key config should be a string or symbol' + expect(entry.errors). + to include 'key config should be a string or symbol' end end @@ -50,8 +50,8 @@ describe Gitlab::Ci::Config::Entry::Cache do let(:config) { { invalid: true } } it 'reports error with descendants' do - expect(entry.errors) - .to include 'cache config contains unknown keys: invalid' + expect(entry.errors). + to include 'cache config contains unknown keys: invalid' end end end diff --git a/spec/lib/gitlab/ci/config/entry/commands_spec.rb b/spec/lib/gitlab/ci/config/entry/commands_spec.rb index afa4a089418..8fe82bc2ebd 100644 --- a/spec/lib/gitlab/ci/config/entry/commands_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/commands_spec.rb @@ -40,8 +40,8 @@ describe Gitlab::Ci::Config::Entry::Commands do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'commands config should be a ' \ + expect(entry.errors). + to include 'commands config should be a ' \ 'string or an array of strings' end end diff --git a/spec/lib/gitlab/ci/config/entry/configurable_spec.rb b/spec/lib/gitlab/ci/config/entry/configurable_spec.rb index ae7e628b5b5..490ba9b7df1 100644 --- a/spec/lib/gitlab/ci/config/entry/configurable_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/configurable_spec.rb @@ -52,8 +52,8 @@ describe Gitlab::Ci::Config::Entry::Configurable do end it 'creates a node factory' do - expect(entry.nodes[:object]) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Factory + expect(entry.nodes[:object]). + to be_an_instance_of Gitlab::Ci::Config::Entry::Factory end it 'returns a duplicated factory object' do diff --git a/spec/lib/gitlab/ci/config/entry/environment_spec.rb b/spec/lib/gitlab/ci/config/entry/environment_spec.rb index 2adbed2154f..fab2825fbb0 100644 --- a/spec/lib/gitlab/ci/config/entry/environment_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/environment_spec.rb @@ -112,8 +112,8 @@ describe Gitlab::Ci::Config::Entry::Environment do describe '#errors' do it 'contains error about invalid action' do - expect(entry.errors) - .to include 'environment action should be start or stop' + expect(entry.errors). + to include 'environment action should be start or stop' end end end @@ -143,8 +143,8 @@ describe Gitlab::Ci::Config::Entry::Environment do describe '#errors' do it 'contains error about invalid action' do - expect(entry.errors) - .to include 'environment on stop should be a string' + expect(entry.errors). + to include 'environment on stop should be a string' end end end @@ -174,8 +174,8 @@ describe Gitlab::Ci::Config::Entry::Environment do describe '#errors' do it 'contains error about invalid type' do - expect(entry.errors) - .to include 'environment config should be a hash or a string' + expect(entry.errors). + to include 'environment config should be a hash or a string' end end end @@ -191,8 +191,8 @@ describe Gitlab::Ci::Config::Entry::Environment do describe '#errors?' do it 'contains error about missing environment name' do - expect(entry.errors) - .to include "environment name can't be blank" + expect(entry.errors). + to include "environment name can't be blank" end end end diff --git a/spec/lib/gitlab/ci/config/entry/factory_spec.rb b/spec/lib/gitlab/ci/config/entry/factory_spec.rb index 3395b3c645b..5c5ce2d6f39 100644 --- a/spec/lib/gitlab/ci/config/entry/factory_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/factory_spec.rb @@ -7,19 +7,19 @@ describe Gitlab::Ci::Config::Entry::Factory do context 'when setting a concrete value' do it 'creates entry with valid value' do - entry = factory - .value(%w(ls pwd)) - .create! + entry = factory. + value(%w(ls pwd)). + create! expect(entry.value).to eq %w(ls pwd) end context 'when setting description' do it 'creates entry with description' do - entry = factory - .value(%w(ls pwd)) - .with(description: 'test description') - .create! + entry = factory. + value(%w(ls pwd)). + with(description: 'test description'). + create! expect(entry.value).to eq %w(ls pwd) expect(entry.description).to eq 'test description' @@ -28,10 +28,10 @@ describe Gitlab::Ci::Config::Entry::Factory do context 'when setting key' do it 'creates entry with custom key' do - entry = factory - .value(%w(ls pwd)) - .with(key: 'test key') - .create! + entry = factory. + value(%w(ls pwd)). + with(key: 'test key'). + create! expect(entry.key).to eq 'test key' end @@ -41,10 +41,10 @@ describe Gitlab::Ci::Config::Entry::Factory do let(:object) { Object.new } it 'creates entry with valid parent' do - entry = factory - .value('ls') - .with(parent: object) - .create! + entry = factory. + value('ls'). + with(parent: object). + create! expect(entry.parent).to eq object end @@ -61,12 +61,12 @@ describe Gitlab::Ci::Config::Entry::Factory do context 'when creating entry with nil value' do it 'creates an undefined entry' do - entry = factory - .value(nil) - .create! + entry = factory. + value(nil). + create! - expect(entry) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Unspecified + expect(entry). + to be_an_instance_of Gitlab::Ci::Config::Entry::Unspecified end end @@ -74,13 +74,13 @@ describe Gitlab::Ci::Config::Entry::Factory do let(:entry) { spy('entry') } it 'passes metadata as a parameter' do - factory - .value('some value') - .metadata(some: 'hash') - .create! + factory. + value('some value'). + metadata(some: 'hash'). + create! - expect(entry).to have_received(:new) - .with('some value', { some: 'hash' }) + expect(entry).to have_received(:new). + with('some value', { some: 'hash' }) end end end diff --git a/spec/lib/gitlab/ci/config/entry/global_spec.rb b/spec/lib/gitlab/ci/config/entry/global_spec.rb index ebd80ac5e1d..67a6b3cc98d 100644 --- a/spec/lib/gitlab/ci/config/entry/global_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/global_spec.rb @@ -10,10 +10,10 @@ describe Gitlab::Ci::Config::Entry::Global do context 'when filtering all the entry/node names' do it 'contains the expected node names' do - expect(described_class.nodes.keys) - .to match_array(%i[before_script image services - after_script variables stages - types cache]) + expect(described_class.nodes.keys). + to match_array(%i[before_script image services + after_script variables stages + types cache]) end end end @@ -44,17 +44,17 @@ describe Gitlab::Ci::Config::Entry::Global do end it 'creates node object using valid class' do - expect(global.descendants.first) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Script - expect(global.descendants.second) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Image + expect(global.descendants.first). + to be_an_instance_of Gitlab::Ci::Config::Entry::Script + expect(global.descendants.second). + to be_an_instance_of Gitlab::Ci::Config::Entry::Image end it 'sets correct description for nodes' do - expect(global.descendants.first.description) - .to eq 'Script that will be executed before each job.' - expect(global.descendants.second.description) - .to eq 'Docker image that will be used to execute jobs.' + expect(global.descendants.first.description). + to eq 'Script that will be executed before each job.' + expect(global.descendants.second.description). + to eq 'Docker image that will be used to execute jobs.' end describe '#leaf?' do @@ -138,8 +138,8 @@ describe Gitlab::Ci::Config::Entry::Global do describe '#cache_value' do it 'returns cache configuration' do - expect(global.cache_value) - .to eq(key: 'k', untracked: true, paths: ['public/']) + expect(global.cache_value). + to eq(key: 'k', untracked: true, paths: ['public/']) end end @@ -185,8 +185,8 @@ describe Gitlab::Ci::Config::Entry::Global do end it 'contains unspecified nodes' do - expect(global.descendants.first) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Unspecified + expect(global.descendants.first). + to be_an_instance_of Gitlab::Ci::Config::Entry::Unspecified end end @@ -246,8 +246,8 @@ describe Gitlab::Ci::Config::Entry::Global do describe '#errors' do it 'reports errors from child nodes' do - expect(global.errors) - .to include 'before_script config should be an array of strings' + expect(global.errors). + to include 'before_script config should be an array of strings' end end @@ -265,8 +265,8 @@ describe Gitlab::Ci::Config::Entry::Global do describe '#errors' do it 'reports errors about missing script' do - expect(global.errors) - .to include "jobs:rspec script can't be blank" + expect(global.errors). + to include "jobs:rspec script can't be blank" end end end @@ -303,16 +303,16 @@ describe Gitlab::Ci::Config::Entry::Global do context 'when entry exists' do it 'returns correct entry' do - expect(global[:cache]) - .to be_an_instance_of Gitlab::Ci::Config::Entry::Cache + expect(global[:cache]). + to be_an_instance_of Gitlab::Ci::Config::Entry::Cache expect(global[:jobs][:rspec][:script].value).to eq ['ls'] end end context 'when entry does not exist' do it 'always return unspecified node' do - expect(global[:some][:unknown][:node]) - .not_to be_specified + expect(global[:some][:unknown][:node]). + not_to be_specified end end end diff --git a/spec/lib/gitlab/ci/config/entry/image_spec.rb b/spec/lib/gitlab/ci/config/entry/image_spec.rb index 3c99cb0a1ee..062817e07fd 100644 --- a/spec/lib/gitlab/ci/config/entry/image_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/image_spec.rb @@ -31,8 +31,8 @@ describe Gitlab::Ci::Config::Entry::Image do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'image config should be a string' + expect(entry.errors). + to include 'image config should be a string' end end diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb index d20f4ec207d..82feff0af1c 100644 --- a/spec/lib/gitlab/ci/config/entry/job_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb @@ -44,8 +44,8 @@ describe Gitlab::Ci::Config::Entry::Job do describe '#errors' do it 'reports error about a config type' do - expect(entry.errors) - .to include 'job config should be a hash' + expect(entry.errors). + to include 'job config should be a hash' end end end @@ -138,13 +138,13 @@ describe Gitlab::Ci::Config::Entry::Job do end it 'returns correct value' do - expect(entry.value) - .to eq(name: :rspec, - before_script: %w[ls pwd], - script: %w[rspec], - commands: "ls\npwd\nrspec", - stage: 'test', - after_script: %w[cleanup]) + expect(entry.value). + to eq(name: :rspec, + before_script: %w[ls pwd], + script: %w[rspec], + commands: "ls\npwd\nrspec", + stage: 'test', + after_script: %w[cleanup]) end end end diff --git a/spec/lib/gitlab/ci/config/entry/jobs_spec.rb b/spec/lib/gitlab/ci/config/entry/jobs_spec.rb index aaebf783962..c332b70dc71 100644 --- a/spec/lib/gitlab/ci/config/entry/jobs_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/jobs_spec.rb @@ -22,8 +22,8 @@ describe Gitlab::Ci::Config::Entry::Jobs do let(:config) { ['incorrect'] } it 'returns error about incorrect type' do - expect(entry.errors) - .to include 'jobs config should be a hash' + expect(entry.errors). + to include 'jobs config should be a hash' end end @@ -39,8 +39,8 @@ describe Gitlab::Ci::Config::Entry::Jobs do let(:config) { { '.hidden'.to_sym => { script: [] } } } it 'returns error about no visible jobs defined' do - expect(entry.errors) - .to include 'jobs config should contain at least one visible job' + expect(entry.errors). + to include 'jobs config should contain at least one visible job' end end end @@ -73,10 +73,10 @@ describe Gitlab::Ci::Config::Entry::Jobs do describe '#descendants' do it 'creates valid descendant nodes' do expect(entry.descendants.count).to eq 3 - expect(entry.descendants.first(2)) - .to all(be_an_instance_of(Gitlab::Ci::Config::Entry::Job)) - expect(entry.descendants.last) - .to be_an_instance_of(Gitlab::Ci::Config::Entry::Hidden) + expect(entry.descendants.first(2)). + to all(be_an_instance_of(Gitlab::Ci::Config::Entry::Job)) + expect(entry.descendants.last). + to be_an_instance_of(Gitlab::Ci::Config::Entry::Hidden) end end diff --git a/spec/lib/gitlab/ci/config/entry/key_spec.rb b/spec/lib/gitlab/ci/config/entry/key_spec.rb index 0dd36fe1f44..cd7b03ffb11 100644 --- a/spec/lib/gitlab/ci/config/entry/key_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/key_spec.rb @@ -25,8 +25,8 @@ describe Gitlab::Ci::Config::Entry::Key do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'key config should be a string or symbol' + expect(entry.errors). + to include 'key config should be a string or symbol' end end end diff --git a/spec/lib/gitlab/ci/config/entry/paths_spec.rb b/spec/lib/gitlab/ci/config/entry/paths_spec.rb index 1d9c5ddee9b..b0ac90f1d94 100644 --- a/spec/lib/gitlab/ci/config/entry/paths_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/paths_spec.rb @@ -25,8 +25,8 @@ describe Gitlab::Ci::Config::Entry::Paths do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'paths config should be an array of strings' + expect(entry.errors). + to include 'paths config should be an array of strings' end end end diff --git a/spec/lib/gitlab/ci/config/entry/script_spec.rb b/spec/lib/gitlab/ci/config/entry/script_spec.rb index 069eaa26422..49cca49509c 100644 --- a/spec/lib/gitlab/ci/config/entry/script_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/script_spec.rb @@ -31,8 +31,8 @@ describe Gitlab::Ci::Config::Entry::Script do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'script config should be an array of strings' + expect(entry.errors). + to include 'script config should be an array of strings' end end diff --git a/spec/lib/gitlab/ci/config/entry/services_spec.rb b/spec/lib/gitlab/ci/config/entry/services_spec.rb index 66fad3b6b16..c31a7c0ec3e 100644 --- a/spec/lib/gitlab/ci/config/entry/services_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/services_spec.rb @@ -25,8 +25,8 @@ describe Gitlab::Ci::Config::Entry::Services do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'services config should be an array of strings' + expect(entry.errors). + to include 'services config should be an array of strings' end end diff --git a/spec/lib/gitlab/ci/config/entry/stage_spec.rb b/spec/lib/gitlab/ci/config/entry/stage_spec.rb index 70c8a0a355a..cefef7a805a 100644 --- a/spec/lib/gitlab/ci/config/entry/stage_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/stage_spec.rb @@ -24,8 +24,8 @@ describe Gitlab::Ci::Config::Entry::Stage do let(:config) { { test: true } } it 'reports errors about wrong type' do - expect(stage.errors) - .to include 'stage config should be a string' + expect(stage.errors). + to include 'stage config should be a string' end end end diff --git a/spec/lib/gitlab/ci/config/entry/stages_spec.rb b/spec/lib/gitlab/ci/config/entry/stages_spec.rb index 182c8d867c7..bdcd6c98a85 100644 --- a/spec/lib/gitlab/ci/config/entry/stages_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/stages_spec.rb @@ -25,8 +25,8 @@ describe Gitlab::Ci::Config::Entry::Stages do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'stages config should be an array of strings' + expect(entry.errors). + to include 'stages config should be an array of strings' end end diff --git a/spec/lib/gitlab/ci/config/entry/trigger_spec.rb b/spec/lib/gitlab/ci/config/entry/trigger_spec.rb index e4ee44f1274..13b00a98b6a 100644 --- a/spec/lib/gitlab/ci/config/entry/trigger_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/trigger_spec.rb @@ -47,8 +47,8 @@ describe Gitlab::Ci::Config::Entry::Trigger do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include 'trigger config should be an array of strings or regexps' + expect(entry.errors). + to include 'trigger config should be an array of strings or regexps' end end end diff --git a/spec/lib/gitlab/ci/config/entry/validatable_spec.rb b/spec/lib/gitlab/ci/config/entry/validatable_spec.rb index d1856801827..e31e85538b9 100644 --- a/spec/lib/gitlab/ci/config/entry/validatable_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/validatable_spec.rb @@ -19,8 +19,8 @@ describe Gitlab::Ci::Config::Entry::Validatable do end it 'returns validator' do - expect(entry.validator.superclass) - .to be Gitlab::Ci::Config::Entry::Validator + expect(entry.validator.superclass). + to be Gitlab::Ci::Config::Entry::Validator end it 'returns only one validator to mitigate leaks' do diff --git a/spec/lib/gitlab/ci/config/entry/validator_spec.rb b/spec/lib/gitlab/ci/config/entry/validator_spec.rb index ad7e6f07d3c..c6e21cd67b0 100644 --- a/spec/lib/gitlab/ci/config/entry/validator_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/validator_spec.rb @@ -47,8 +47,8 @@ describe Gitlab::Ci::Config::Entry::Validator do it 'returns errors' do validator_instance.validate - expect(validator_instance.messages) - .to include "node test attribute can't be blank" + expect(validator_instance.messages). + to include "node test attribute can't be blank" end end end diff --git a/spec/lib/gitlab/ci/config/entry/variables_spec.rb b/spec/lib/gitlab/ci/config/entry/variables_spec.rb index f15f02f403e..c117f35c906 100644 --- a/spec/lib/gitlab/ci/config/entry/variables_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/variables_spec.rb @@ -33,8 +33,8 @@ describe Gitlab::Ci::Config::Entry::Variables do describe '#errors' do it 'saves errors' do - expect(entry.errors) - .to include /should be a hash of key value pairs/ + expect(entry.errors). + to include /should be a hash of key value pairs/ end end diff --git a/spec/lib/gitlab/ci/status/build/common_spec.rb b/spec/lib/gitlab/ci/status/build/common_spec.rb index 40b96b1807b..cd893a09748 100644 --- a/spec/lib/gitlab/ci/status/build/common_spec.rb +++ b/spec/lib/gitlab/ci/status/build/common_spec.rb @@ -6,9 +6,9 @@ describe Gitlab::Ci::Status::Build::Common do let(:project) { build.project } subject do - Gitlab::Ci::Status::Core - .new(build, user) - .extend(described_class) + Gitlab::Ci::Status::Core. + new(build, user). + extend(described_class) end describe '#has_action?' do diff --git a/spec/lib/gitlab/ci/status/build/factory_spec.rb b/spec/lib/gitlab/ci/status/build/factory_spec.rb index 0c40fca0c1a..aa026a66460 100644 --- a/spec/lib/gitlab/ci/status/build/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/build/factory_spec.rb @@ -16,8 +16,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Retryable] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Retryable] end it 'fabricates a retryable build status' do @@ -42,8 +42,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Retryable] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Retryable] end it 'fabricates a retryable build status' do @@ -67,9 +67,9 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Retryable, - Gitlab::Ci::Status::Build::FailedAllowed] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Retryable, + Gitlab::Ci::Status::Build::FailedAllowed] end it 'fabricates a failed but allowed build status' do @@ -96,8 +96,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Retryable] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Retryable] end it 'fabricates a retryable build status' do @@ -121,8 +121,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Cancelable] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Cancelable] end it 'fabricates a canceable build status' do @@ -146,8 +146,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Cancelable] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Cancelable] end it 'fabricates a cancelable build status' do @@ -196,8 +196,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Play] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Play] end it 'fabricates a core skipped status' do @@ -222,8 +222,8 @@ describe Gitlab::Ci::Status::Build::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Stop] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::Build::Stop] end it 'fabricates a core skipped status' do diff --git a/spec/lib/gitlab/ci/status/extended_spec.rb b/spec/lib/gitlab/ci/status/extended_spec.rb index c2d74ca5cde..459044eb968 100644 --- a/spec/lib/gitlab/ci/status/extended_spec.rb +++ b/spec/lib/gitlab/ci/status/extended_spec.rb @@ -6,7 +6,7 @@ describe Gitlab::Ci::Status::Extended do end it 'requires subclass to implement matcher' do - expect { subject.matches?(double, double) } - .to raise_error(NotImplementedError) + expect { subject.matches?(double, double) }. + to raise_error(NotImplementedError) end end diff --git a/spec/lib/gitlab/ci/status/external/common_spec.rb b/spec/lib/gitlab/ci/status/external/common_spec.rb index 5a97d98b55f..6a564eeb8b7 100644 --- a/spec/lib/gitlab/ci/status/external/common_spec.rb +++ b/spec/lib/gitlab/ci/status/external/common_spec.rb @@ -10,9 +10,9 @@ describe Gitlab::Ci::Status::External::Common do end subject do - Gitlab::Ci::Status::Core - .new(external_status, user) - .extend(described_class) + Gitlab::Ci::Status::Core. + new(external_status, user). + extend(described_class) end describe '#has_action?' do diff --git a/spec/lib/gitlab/ci/status/factory_spec.rb b/spec/lib/gitlab/ci/status/factory_spec.rb index bbf9c7c83a3..45fd49b91ea 100644 --- a/spec/lib/gitlab/ci/status/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/factory_spec.rb @@ -84,15 +84,15 @@ describe Gitlab::Ci::Status::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [first_extended_status, second_extended_status] + expect(factory.extended_statuses). + to eq [first_extended_status, second_extended_status] end end context 'when exclusive statuses are matches' do before do - allow(described_class).to receive(:extended_statuses) - .and_return([[first_extended_status, second_extended_status]]) + allow(described_class).to receive(:extended_statuses). + and_return([[first_extended_status, second_extended_status]]) end it 'does not fabricate compound decorator' do @@ -116,8 +116,8 @@ describe Gitlab::Ci::Status::Factory do context 'when exclusive statuses are not matched' do before do - allow(described_class).to receive(:extended_statuses) - .and_return([[first_extended_status], [second_extended_status]]) + allow(described_class).to receive(:extended_statuses). + and_return([[first_extended_status], [second_extended_status]]) end it_behaves_like 'compound decorator factory' @@ -125,8 +125,8 @@ describe Gitlab::Ci::Status::Factory do context 'when using simplified status grouping' do before do - allow(described_class).to receive(:extended_statuses) - .and_return([first_extended_status, second_extended_status]) + allow(described_class).to receive(:extended_statuses). + and_return([first_extended_status, second_extended_status]) end it_behaves_like 'compound decorator factory' diff --git a/spec/lib/gitlab/ci/status/pipeline/common_spec.rb b/spec/lib/gitlab/ci/status/pipeline/common_spec.rb index d665674bf70..35dad60febf 100644 --- a/spec/lib/gitlab/ci/status/pipeline/common_spec.rb +++ b/spec/lib/gitlab/ci/status/pipeline/common_spec.rb @@ -6,9 +6,9 @@ describe Gitlab::Ci::Status::Pipeline::Common do let(:pipeline) { create(:ci_pipeline, project: project) } subject do - Gitlab::Ci::Status::Core - .new(pipeline, user) - .extend(described_class) + Gitlab::Ci::Status::Core. + new(pipeline, user). + extend(described_class) end describe '#has_action?' do @@ -29,8 +29,8 @@ describe Gitlab::Ci::Status::Pipeline::Common do describe '#details_path' do it 'links to the pipeline details page' do - expect(subject.details_path) - .to include "pipelines/#{pipeline.id}" + expect(subject.details_path). + to include "pipelines/#{pipeline.id}" end end end diff --git a/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb b/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb index b10a447c27a..7cee4435931 100644 --- a/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb @@ -34,8 +34,8 @@ describe Gitlab::Ci::Status::Pipeline::Factory do it 'extends core status with common pipeline methods' do expect(status).to have_details expect(status).not_to have_action - expect(status.details_path) - .to include "pipelines/#{pipeline.id}" + expect(status.details_path). + to include "pipelines/#{pipeline.id}" end end end @@ -55,8 +55,8 @@ describe Gitlab::Ci::Status::Pipeline::Factory do end it 'matches correct extended statuses' do - expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::SuccessWarning] + expect(factory.extended_statuses). + to eq [Gitlab::Ci::Status::SuccessWarning] end it 'fabricates extended "success with warnings" status' do diff --git a/spec/lib/gitlab/ci/status/stage/common_spec.rb b/spec/lib/gitlab/ci/status/stage/common_spec.rb index 8814a7614a0..3b25893d8c7 100644 --- a/spec/lib/gitlab/ci/status/stage/common_spec.rb +++ b/spec/lib/gitlab/ci/status/stage/common_spec.rb @@ -10,8 +10,8 @@ describe Gitlab::Ci::Status::Stage::Common do end subject do - Class.new(Gitlab::Ci::Status::Core) - .new(stage, user).extend(described_class) + Class.new(Gitlab::Ci::Status::Core). + new(stage, user).extend(described_class) end it 'does not have action' do @@ -19,10 +19,10 @@ describe Gitlab::Ci::Status::Stage::Common do end it 'links to the pipeline details page' do - expect(subject.details_path) - .to include "pipelines/#{pipeline.id}" - expect(subject.details_path) - .to include "##{stage.name}" + expect(subject.details_path). + to include "pipelines/#{pipeline.id}" + expect(subject.details_path). + to include "##{stage.name}" end context 'when user has permission to read pipeline' do diff --git a/spec/lib/gitlab/ci/status/stage/factory_spec.rb b/spec/lib/gitlab/ci/status/stage/factory_spec.rb index bbb40e2c1ab..c8503392b34 100644 --- a/spec/lib/gitlab/ci/status/stage/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/stage/factory_spec.rb @@ -55,8 +55,8 @@ describe Gitlab::Ci::Status::Stage::Factory do end it 'fabricates extended "success with warnings" status' do - expect(status) - .to be_a Gitlab::Ci::Status::SuccessWarning + expect(status). + to be_a Gitlab::Ci::Status::SuccessWarning end it 'extends core status with common stage method' do diff --git a/spec/lib/gitlab/closing_issue_extractor_spec.rb b/spec/lib/gitlab/closing_issue_extractor_spec.rb index ca68010cb89..97af1c2523d 100644 --- a/spec/lib/gitlab/closing_issue_extractor_spec.rb +++ b/spec/lib/gitlab/closing_issue_extractor_spec.rb @@ -306,58 +306,58 @@ describe Gitlab::ClosingIssueExtractor, lib: true do it 'fetches issues in single line message' do message = "Closes #{reference} and fix #{reference2}" - expect(subject.closed_by_message(message)) - .to match_array([issue, other_issue]) + expect(subject.closed_by_message(message)). + to match_array([issue, other_issue]) end it 'fetches comma-separated issues references in single line message' do message = "Closes #{reference}, closes #{reference2}" - expect(subject.closed_by_message(message)) - .to match_array([issue, other_issue]) + expect(subject.closed_by_message(message)). + to match_array([issue, other_issue]) end it 'fetches comma-separated issues numbers in single line message' do message = "Closes #{reference}, #{reference2} and #{reference3}" - expect(subject.closed_by_message(message)) - .to match_array([issue, other_issue, third_issue]) + expect(subject.closed_by_message(message)). + to match_array([issue, other_issue, third_issue]) end it 'fetches issues in multi-line message' do message = "Awesome commit (closes #{reference})\nAlso fixes #{reference2}" - expect(subject.closed_by_message(message)) - .to match_array([issue, other_issue]) + expect(subject.closed_by_message(message)). + to match_array([issue, other_issue]) end it 'fetches issues in hybrid message' do message = "Awesome commit (closes #{reference})\n"\ "Also fixing issues #{reference2}, #{reference3} and #4" - expect(subject.closed_by_message(message)) - .to match_array([issue, other_issue, third_issue]) + expect(subject.closed_by_message(message)). + to match_array([issue, other_issue, third_issue]) end it "fetches cross-project references" do message = "Closes #{reference} and #{cross_reference}" - expect(subject.closed_by_message(message)) - .to match_array([issue, issue2]) + expect(subject.closed_by_message(message)). + to match_array([issue, issue2]) end it "fetches cross-project URL references" do message = "Closes #{urls.namespace_project_issue_url(issue2.project.namespace, issue2.project, issue2)} and #{reference}" - expect(subject.closed_by_message(message)) - .to match_array([issue, issue2]) + expect(subject.closed_by_message(message)). + to match_array([issue, issue2]) end it "ignores invalid cross-project URL references" do message = "Closes https://google.com#{urls.namespace_project_issue_path(issue2.project.namespace, issue2.project, issue2)} and #{reference}" - expect(subject.closed_by_message(message)) - .to match_array([issue]) + expect(subject.closed_by_message(message)). + to match_array([issue]) end end end diff --git a/spec/lib/gitlab/conflict/file_spec.rb b/spec/lib/gitlab/conflict/file_spec.rb index b3e107dca72..7e5531d92dc 100644 --- a/spec/lib/gitlab/conflict/file_spec.rb +++ b/spec/lib/gitlab/conflict/file_spec.rb @@ -43,8 +43,8 @@ describe Gitlab::Conflict::File, lib: true do end it 'returns a file containing only the chosen parts of the resolved sections' do - expect(resolved_lines.chunk { |line| line.type || 'both' }.map(&:first)) - .to eq(%w(both new both old both new both)) + expect(resolved_lines.chunk { |line| line.type || 'both' }.map(&:first)). + to eq(%w(both new both old both new both)) end end @@ -52,14 +52,14 @@ describe Gitlab::Conflict::File, lib: true do empty_hash = section_keys.map { |key| [key, nil] }.to_h invalid_hash = section_keys.map { |key| [key, 'invalid'] }.to_h - expect { conflict_file.resolve_lines({}) } - .to raise_error(Gitlab::Conflict::File::MissingResolution) + expect { conflict_file.resolve_lines({}) }. + to raise_error(Gitlab::Conflict::File::MissingResolution) - expect { conflict_file.resolve_lines(empty_hash) } - .to raise_error(Gitlab::Conflict::File::MissingResolution) + expect { conflict_file.resolve_lines(empty_hash) }. + to raise_error(Gitlab::Conflict::File::MissingResolution) - expect { conflict_file.resolve_lines(invalid_hash) } - .to raise_error(Gitlab::Conflict::File::MissingResolution) + expect { conflict_file.resolve_lines(invalid_hash) }. + to raise_error(Gitlab::Conflict::File::MissingResolution) end end @@ -250,8 +250,8 @@ FILE describe '#as_json' do it 'includes the blob path for the file' do - expect(conflict_file.as_json[:blob_path]) - .to eq("/#{project.namespace.to_param}/#{merge_request.project.to_param}/blob/#{our_commit.oid}/files/ruby/regex.rb") + expect(conflict_file.as_json[:blob_path]). + to eq("/#{project.namespace.to_param}/#{merge_request.project.to_param}/blob/#{our_commit.oid}/files/ruby/regex.rb") end it 'includes the blob icon for the file' do @@ -264,8 +264,8 @@ FILE end it 'includes the detected language of the conflict file' do - expect(conflict_file.as_json(full_content: true)[:blob_ace_mode]) - .to eq('ruby') + expect(conflict_file.as_json(full_content: true)[:blob_ace_mode]). + to eq('ruby') end end end diff --git a/spec/lib/gitlab/conflict/parser_spec.rb b/spec/lib/gitlab/conflict/parser_spec.rb index ca4bdcc3672..16eb3766356 100644 --- a/spec/lib/gitlab/conflict/parser_spec.rb +++ b/spec/lib/gitlab/conflict/parser_spec.rb @@ -121,72 +121,72 @@ CONFLICT context 'when the file contents include conflict delimiters' do it 'raises UnexpectedDelimiter when there is a non-start delimiter first' do - expect { parse_text('=======') } - .to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) + expect { parse_text('=======') }. + to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) - expect { parse_text('>>>>>>> README.md') } - .to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) + expect { parse_text('>>>>>>> README.md') }. + to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) - expect { parse_text('>>>>>>> some-other-path.md') } - .not_to raise_error + expect { parse_text('>>>>>>> some-other-path.md') }. + not_to raise_error end it 'raises UnexpectedDelimiter when a start delimiter is followed by a non-middle delimiter' do start_text = "<<<<<<< README.md\n" end_text = "\n=======\n>>>>>>> README.md" - expect { parse_text(start_text + '>>>>>>> README.md' + end_text) } - .to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) + expect { parse_text(start_text + '>>>>>>> README.md' + end_text) }. + to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) - expect { parse_text(start_text + start_text + end_text) } - .to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) + expect { parse_text(start_text + start_text + end_text) }. + to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) - expect { parse_text(start_text + '>>>>>>> some-other-path.md' + end_text) } - .not_to raise_error + expect { parse_text(start_text + '>>>>>>> some-other-path.md' + end_text) }. + not_to raise_error end it 'raises UnexpectedDelimiter when a middle delimiter is followed by a non-end delimiter' do start_text = "<<<<<<< README.md\n=======\n" end_text = "\n>>>>>>> README.md" - expect { parse_text(start_text + '=======' + end_text) } - .to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) + expect { parse_text(start_text + '=======' + end_text) }. + to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) - expect { parse_text(start_text + start_text + end_text) } - .to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) + expect { parse_text(start_text + start_text + end_text) }. + to raise_error(Gitlab::Conflict::Parser::UnexpectedDelimiter) - expect { parse_text(start_text + '>>>>>>> some-other-path.md' + end_text) } - .not_to raise_error + expect { parse_text(start_text + '>>>>>>> some-other-path.md' + end_text) }. + not_to raise_error end it 'raises MissingEndDelimiter when there is no end delimiter at the end' do start_text = "<<<<<<< README.md\n=======\n" - expect { parse_text(start_text) } - .to raise_error(Gitlab::Conflict::Parser::MissingEndDelimiter) + expect { parse_text(start_text) }. + to raise_error(Gitlab::Conflict::Parser::MissingEndDelimiter) - expect { parse_text(start_text + '>>>>>>> some-other-path.md') } - .to raise_error(Gitlab::Conflict::Parser::MissingEndDelimiter) + expect { parse_text(start_text + '>>>>>>> some-other-path.md') }. + to raise_error(Gitlab::Conflict::Parser::MissingEndDelimiter) end end context 'other file types' do it 'raises UnmergeableFile when lines is blank, indicating a binary file' do - expect { parse_text('') } - .to raise_error(Gitlab::Conflict::Parser::UnmergeableFile) + expect { parse_text('') }. + to raise_error(Gitlab::Conflict::Parser::UnmergeableFile) - expect { parse_text(nil) } - .to raise_error(Gitlab::Conflict::Parser::UnmergeableFile) + expect { parse_text(nil) }. + to raise_error(Gitlab::Conflict::Parser::UnmergeableFile) end it 'raises UnmergeableFile when the file is over 200 KB' do - expect { parse_text('a' * 204801) } - .to raise_error(Gitlab::Conflict::Parser::UnmergeableFile) + expect { parse_text('a' * 204801) }. + to raise_error(Gitlab::Conflict::Parser::UnmergeableFile) end it 'raises UnsupportedEncoding when the file contains non-UTF-8 characters' do - expect { parse_text("a\xC4\xFC".force_encoding(Encoding::ASCII_8BIT)) } - .to raise_error(Gitlab::Conflict::Parser::UnsupportedEncoding) + expect { parse_text("a\xC4\xFC".force_encoding(Encoding::ASCII_8BIT)) }. + to raise_error(Gitlab::Conflict::Parser::UnsupportedEncoding) end end end diff --git a/spec/lib/gitlab/data_builder/note_spec.rb b/spec/lib/gitlab/data_builder/note_spec.rb index 04ec34492e1..7658153df0b 100644 --- a/spec/lib/gitlab/data_builder/note_spec.rb +++ b/spec/lib/gitlab/data_builder/note_spec.rb @@ -9,8 +9,8 @@ describe Gitlab::DataBuilder::Note, lib: true do before(:each) do expect(data).to have_key(:object_attributes) expect(data[:object_attributes]).to have_key(:url) - expect(data[:object_attributes][:url]) - .to eq(Gitlab::UrlBuilder.build(note)) + expect(data[:object_attributes][:url]). + to eq(Gitlab::UrlBuilder.build(note)) expect(data[:object_kind]).to eq('note') expect(data[:user]).to eq(user.hook_attrs) end @@ -49,10 +49,10 @@ describe Gitlab::DataBuilder::Note, lib: true do it 'returns the note and issue-specific data' do expect(data).to have_key(:issue) - expect(data[:issue].except('updated_at')) - .to eq(issue.reload.hook_attrs.except('updated_at')) - expect(data[:issue]['updated_at']) - .to be > issue.hook_attrs['updated_at'] + expect(data[:issue].except('updated_at')). + to eq(issue.reload.hook_attrs.except('updated_at')) + expect(data[:issue]['updated_at']). + to be > issue.hook_attrs['updated_at'] end include_examples 'project hook data' @@ -73,10 +73,10 @@ describe Gitlab::DataBuilder::Note, lib: true do it 'returns the note and merge request data' do expect(data).to have_key(:merge_request) - expect(data[:merge_request].except('updated_at')) - .to eq(merge_request.reload.hook_attrs.except('updated_at')) - expect(data[:merge_request]['updated_at']) - .to be > merge_request.hook_attrs['updated_at'] + expect(data[:merge_request].except('updated_at')). + to eq(merge_request.reload.hook_attrs.except('updated_at')) + expect(data[:merge_request]['updated_at']). + to be > merge_request.hook_attrs['updated_at'] end include_examples 'project hook data' @@ -96,10 +96,10 @@ describe Gitlab::DataBuilder::Note, lib: true do it 'returns the note and merge request diff data' do expect(data).to have_key(:merge_request) - expect(data[:merge_request].except('updated_at')) - .to eq(merge_request.reload.hook_attrs.except('updated_at')) - expect(data[:merge_request]['updated_at']) - .to be > merge_request.hook_attrs['updated_at'] + expect(data[:merge_request].except('updated_at')). + to eq(merge_request.reload.hook_attrs.except('updated_at')) + expect(data[:merge_request]['updated_at']). + to be > merge_request.hook_attrs['updated_at'] end include_examples 'project hook data' @@ -119,10 +119,10 @@ describe Gitlab::DataBuilder::Note, lib: true do it 'returns the note and project snippet data' do expect(data).to have_key(:snippet) - expect(data[:snippet].except('updated_at')) - .to eq(snippet.reload.hook_attrs.except('updated_at')) - expect(data[:snippet]['updated_at']) - .to be > snippet.hook_attrs['updated_at'] + expect(data[:snippet].except('updated_at')). + to eq(snippet.reload.hook_attrs.except('updated_at')) + expect(data[:snippet]['updated_at']). + to be > snippet.hook_attrs['updated_at'] end include_examples 'project hook data' diff --git a/spec/lib/gitlab/data_builder/push_spec.rb b/spec/lib/gitlab/data_builder/push_spec.rb index 019d7d75814..dbcfb9b7400 100644 --- a/spec/lib/gitlab/data_builder/push_spec.rb +++ b/spec/lib/gitlab/data_builder/push_spec.rb @@ -46,8 +46,8 @@ describe Gitlab::DataBuilder::Push, lib: true do include_examples 'deprecated repository hook data' it 'does not raise an error when given nil commits' do - expect { described_class.build(spy, spy, spy, spy, spy, nil) } - .not_to raise_error + expect { described_class.build(spy, spy, spy, spy, spy, nil) }. + not_to raise_error end end end diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index 511b4a988aa..e007044868c 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -22,15 +22,15 @@ describe Gitlab::Database::MigrationHelpers, lib: true do end it 'creates the index concurrently' do - expect(model).to receive(:add_index) - .with(:users, :foo, algorithm: :concurrently) + expect(model).to receive(:add_index). + with(:users, :foo, algorithm: :concurrently) model.add_concurrent_index(:users, :foo) end it 'creates unique index concurrently' do - expect(model).to receive(:add_index) - .with(:users, :foo, { algorithm: :concurrently, unique: true }) + expect(model).to receive(:add_index). + with(:users, :foo, { algorithm: :concurrently, unique: true }) model.add_concurrent_index(:users, :foo, unique: true) end @@ -40,8 +40,8 @@ describe Gitlab::Database::MigrationHelpers, lib: true do it 'creates a regular index' do expect(Gitlab::Database).to receive(:postgresql?).and_return(false) - expect(model).to receive(:add_index) - .with(:users, :foo, {}) + expect(model).to receive(:add_index). + with(:users, :foo, {}) model.add_concurrent_index(:users, :foo) end @@ -52,8 +52,8 @@ describe Gitlab::Database::MigrationHelpers, lib: true do it 'raises RuntimeError' do expect(model).to receive(:transaction_open?).and_return(true) - expect { model.add_concurrent_index(:users, :foo) } - .to raise_error(RuntimeError) + expect { model.add_concurrent_index(:users, :foo) }. + to raise_error(RuntimeError) end end end @@ -78,8 +78,8 @@ describe Gitlab::Database::MigrationHelpers, lib: true do it 'creates a regular foreign key' do allow(Gitlab::Database).to receive(:mysql?).and_return(true) - expect(model).to receive(:add_foreign_key) - .with(:projects, :users, column: :user_id, on_delete: :cascade) + expect(model).to receive(:add_foreign_key). + with(:projects, :users, column: :user_id, on_delete: :cascade) model.add_concurrent_foreign_key(:projects, :users, column: :user_id) end @@ -171,16 +171,16 @@ describe Gitlab::Database::MigrationHelpers, lib: true do expect(model).to receive(:transaction).and_yield - expect(model).to receive(:add_column) - .with(:projects, :foo, :integer, default: nil) + expect(model).to receive(:add_column). + with(:projects, :foo, :integer, default: nil) - expect(model).to receive(:change_column_default) - .with(:projects, :foo, 10) + expect(model).to receive(:change_column_default). + with(:projects, :foo, 10) end it 'adds the column while allowing NULL values' do - expect(model).to receive(:update_column_in_batches) - .with(:projects, :foo, 10) + expect(model).to receive(:update_column_in_batches). + with(:projects, :foo, 10) expect(model).not_to receive(:change_column_null) @@ -190,22 +190,22 @@ describe Gitlab::Database::MigrationHelpers, lib: true do end it 'adds the column while not allowing NULL values' do - expect(model).to receive(:update_column_in_batches) - .with(:projects, :foo, 10) + expect(model).to receive(:update_column_in_batches). + with(:projects, :foo, 10) - expect(model).to receive(:change_column_null) - .with(:projects, :foo, false) + expect(model).to receive(:change_column_null). + with(:projects, :foo, false) model.add_column_with_default(:projects, :foo, :integer, default: 10) end it 'removes the added column whenever updating the rows fails' do - expect(model).to receive(:update_column_in_batches) - .with(:projects, :foo, 10) - .and_raise(RuntimeError) + expect(model).to receive(:update_column_in_batches). + with(:projects, :foo, 10). + and_raise(RuntimeError) - expect(model).to receive(:remove_column) - .with(:projects, :foo) + expect(model).to receive(:remove_column). + with(:projects, :foo) expect do model.add_column_with_default(:projects, :foo, :integer, default: 10) @@ -213,12 +213,12 @@ describe Gitlab::Database::MigrationHelpers, lib: true do end it 'removes the added column whenever changing a column NULL constraint fails' do - expect(model).to receive(:change_column_null) - .with(:projects, :foo, false) - .and_raise(RuntimeError) + expect(model).to receive(:change_column_null). + with(:projects, :foo, false). + and_raise(RuntimeError) - expect(model).to receive(:remove_column) - .with(:projects, :foo) + expect(model).to receive(:remove_column). + with(:projects, :foo) expect do model.add_column_with_default(:projects, :foo, :integer, default: 10) @@ -234,8 +234,8 @@ describe Gitlab::Database::MigrationHelpers, lib: true do allow(model).to receive(:change_column_null).with(:projects, :foo, false) allow(model).to receive(:change_column_default).with(:projects, :foo, 10) - expect(model).to receive(:add_column) - .with(:projects, :foo, :integer, default: nil, limit: 8) + expect(model).to receive(:add_column). + with(:projects, :foo, :integer, default: nil, limit: 8) model.add_column_with_default(:projects, :foo, :integer, default: 10, limit: 8) end diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb index 053ce1d9e68..5eff7e8425b 100644 --- a/spec/lib/gitlab/database_spec.rb +++ b/spec/lib/gitlab/database_spec.rb @@ -28,8 +28,8 @@ describe Gitlab::Database, lib: true do describe '.version' do context "on mysql" do it "extracts the version number" do - allow(described_class).to receive(:database_version) - .and_return("5.7.12-standard") + allow(described_class).to receive(:database_version). + and_return("5.7.12-standard") expect(described_class.version).to eq '5.7.12-standard' end @@ -37,8 +37,8 @@ describe Gitlab::Database, lib: true do context "on postgresql" do it "extracts the version number" do - allow(described_class).to receive(:database_version) - .and_return("PostgreSQL 9.4.4 on x86_64-apple-darwin14.3.0") + allow(described_class).to receive(:database_version). + and_return("PostgreSQL 9.4.4 on x86_64-apple-darwin14.3.0") expect(described_class.version).to eq '9.4.4' end @@ -120,8 +120,8 @@ describe Gitlab::Database, lib: true do pool = described_class.create_connection_pool(5) begin - expect(pool) - .to be_kind_of(ActiveRecord::ConnectionAdapters::ConnectionPool) + expect(pool). + to be_kind_of(ActiveRecord::ConnectionAdapters::ConnectionPool) expect(pool.spec.config[:pool]).to eq(5) ensure diff --git a/spec/lib/gitlab/downtime_check_spec.rb b/spec/lib/gitlab/downtime_check_spec.rb index 1f1e4e0216c..42d895e548e 100644 --- a/spec/lib/gitlab/downtime_check_spec.rb +++ b/spec/lib/gitlab/downtime_check_spec.rb @@ -11,12 +11,12 @@ describe Gitlab::DowntimeCheck do context 'when a migration does not specify if downtime is required' do it 'raises RuntimeError' do - expect(subject).to receive(:class_for_migration_file) - .with(path) - .and_return(Class.new) + expect(subject).to receive(:class_for_migration_file). + with(path). + and_return(Class.new) - expect { subject.check([path]) } - .to raise_error(RuntimeError, /it requires downtime/) + expect { subject.check([path]) }. + to raise_error(RuntimeError, /it requires downtime/) end end @@ -25,12 +25,12 @@ describe Gitlab::DowntimeCheck do it 'raises RuntimeError' do stub_const('TestMigration::DOWNTIME', true) - expect(subject).to receive(:class_for_migration_file) - .with(path) - .and_return(TestMigration) + expect(subject).to receive(:class_for_migration_file). + with(path). + and_return(TestMigration) - expect { subject.check([path]) } - .to raise_error(RuntimeError, /no reason was given/) + expect { subject.check([path]) }. + to raise_error(RuntimeError, /no reason was given/) end end @@ -39,9 +39,9 @@ describe Gitlab::DowntimeCheck do stub_const('TestMigration::DOWNTIME', true) stub_const('TestMigration::DOWNTIME_REASON', 'foo') - expect(subject).to receive(:class_for_migration_file) - .with(path) - .and_return(TestMigration) + expect(subject).to receive(:class_for_migration_file). + with(path). + and_return(TestMigration) messages = subject.check([path]) @@ -65,9 +65,9 @@ describe Gitlab::DowntimeCheck do expect(subject).to receive(:require).with(path) - expect(subject).to receive(:class_for_migration_file) - .with(path) - .and_return(TestMigration) + expect(subject).to receive(:class_for_migration_file). + with(path). + and_return(TestMigration) expect(subject).to receive(:puts).with(an_instance_of(String)) diff --git a/spec/lib/gitlab/email/reply_parser_spec.rb b/spec/lib/gitlab/email/reply_parser_spec.rb index 02ff2a46c48..28698e89c33 100644 --- a/spec/lib/gitlab/email/reply_parser_spec.rb +++ b/spec/lib/gitlab/email/reply_parser_spec.rb @@ -20,8 +20,8 @@ describe Gitlab::Email::ReplyParser, lib: true do end it "properly renders plaintext-only email" do - expect(test_parse_body(fixture_file("emails/plaintext_only.eml"))) - .to eq( + expect(test_parse_body(fixture_file("emails/plaintext_only.eml"))). + to eq( <<-BODY.strip_heredoc.chomp ### reply from default mail client in Windows 8.1 Metro @@ -46,8 +46,8 @@ describe Gitlab::Email::ReplyParser, lib: true do end it "handles multiple paragraphs" do - expect(test_parse_body(fixture_file("emails/paragraphs.eml"))) - .to eq( + expect(test_parse_body(fixture_file("emails/paragraphs.eml"))). + to eq( <<-BODY.strip_heredoc.chomp Is there any reason the *old* candy can't be be kept in silos while the new candy is imported into *new* silos? @@ -61,8 +61,8 @@ describe Gitlab::Email::ReplyParser, lib: true do end it "handles multiple paragraphs when parsing html" do - expect(test_parse_body(fixture_file("emails/html_paragraphs.eml"))) - .to eq( + expect(test_parse_body(fixture_file("emails/html_paragraphs.eml"))). + to eq( <<-BODY.strip_heredoc.chomp Awesome! @@ -74,8 +74,8 @@ describe Gitlab::Email::ReplyParser, lib: true do end it "handles newlines" do - expect(test_parse_body(fixture_file("emails/newlines.eml"))) - .to eq( + expect(test_parse_body(fixture_file("emails/newlines.eml"))). + to eq( <<-BODY.strip_heredoc.chomp This is my reply. It is my best reply. @@ -85,8 +85,8 @@ describe Gitlab::Email::ReplyParser, lib: true do end it "handles inline reply" do - expect(test_parse_body(fixture_file("emails/inline_reply.eml"))) - .to eq( + expect(test_parse_body(fixture_file("emails/inline_reply.eml"))). + to eq( <<-BODY.strip_heredoc.chomp > techAPJ <https://meta.discourse.org/users/techapj> > November 28 @@ -132,8 +132,8 @@ describe Gitlab::Email::ReplyParser, lib: true do end it "properly renders email reply from gmail web client" do - expect(test_parse_body(fixture_file("emails/gmail_web.eml"))) - .to eq( + expect(test_parse_body(fixture_file("emails/gmail_web.eml"))). + to eq( <<-BODY.strip_heredoc.chomp ### This is a reply from standard GMail in Google Chrome. @@ -151,8 +151,8 @@ describe Gitlab::Email::ReplyParser, lib: true do end it "properly renders email reply from iOS default mail client" do - expect(test_parse_body(fixture_file("emails/ios_default.eml"))) - .to eq( + expect(test_parse_body(fixture_file("emails/ios_default.eml"))). + to eq( <<-BODY.strip_heredoc.chomp ### this is a reply from iOS default mail @@ -166,8 +166,8 @@ describe Gitlab::Email::ReplyParser, lib: true do end it "properly renders email reply from Android 5 gmail client" do - expect(test_parse_body(fixture_file("emails/android_gmail.eml"))) - .to eq( + expect(test_parse_body(fixture_file("emails/android_gmail.eml"))). + to eq( <<-BODY.strip_heredoc.chomp ### this is a reply from Android 5 gmail @@ -184,8 +184,8 @@ describe Gitlab::Email::ReplyParser, lib: true do end it "properly renders email reply from Windows 8.1 Metro default mail client" do - expect(test_parse_body(fixture_file("emails/windows_8_metro.eml"))) - .to eq( + expect(test_parse_body(fixture_file("emails/windows_8_metro.eml"))). + to eq( <<-BODY.strip_heredoc.chomp ### reply from default mail client in Windows 8.1 Metro diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb index 695fd6f8573..e5ba13bbaf8 100644 --- a/spec/lib/gitlab/file_detector_spec.rb +++ b/spec/lib/gitlab/file_detector_spec.rb @@ -3,13 +3,13 @@ require 'spec_helper' describe Gitlab::FileDetector do describe '.types_in_paths' do it 'returns the file types for the given paths' do - expect(described_class.types_in_paths(%w(README.md CHANGELOG VERSION VERSION))) - .to eq(%i{readme changelog version}) + expect(described_class.types_in_paths(%w(README.md CHANGELOG VERSION VERSION))). + to eq(%i{readme changelog version}) end it 'does not include unrecognized file paths' do - expect(described_class.types_in_paths(%w(README.md foo.txt))) - .to eq(%i{readme}) + expect(described_class.types_in_paths(%w(README.md foo.txt))). + to eq(%i{readme}) end end diff --git a/spec/lib/gitlab/git/attributes_spec.rb b/spec/lib/gitlab/git/attributes_spec.rb index b29107eece4..9c011e34c11 100644 --- a/spec/lib/gitlab/git/attributes_spec.rb +++ b/spec/lib/gitlab/git/attributes_spec.rb @@ -14,13 +14,13 @@ describe Gitlab::Git::Attributes, seed_helper: true do end it 'returns a Hash containing multiple attributes' do - expect(subject.attributes('test.sh')) - .to eq({ 'eol' => 'lf', 'gitlab-language' => 'shell' }) + expect(subject.attributes('test.sh')). + to eq({ 'eol' => 'lf', 'gitlab-language' => 'shell' }) end it 'returns a Hash containing attributes for a file with multiple extensions' do - expect(subject.attributes('test.haml.html')) - .to eq({ 'gitlab-language' => 'haml' }) + expect(subject.attributes('test.haml.html')). + to eq({ 'gitlab-language' => 'haml' }) end it 'returns a Hash containing attributes for a file in a directory' do @@ -28,8 +28,8 @@ describe Gitlab::Git::Attributes, seed_helper: true do end it 'returns a Hash containing attributes with query string parameters' do - expect(subject.attributes('foo.cgi')) - .to eq({ 'key' => 'value?p1=v1&p2=v2' }) + expect(subject.attributes('foo.cgi')). + to eq({ 'key' => 'value?p1=v1&p2=v2' }) end it 'returns a Hash containing the attributes for an absolute path' do @@ -39,11 +39,11 @@ describe Gitlab::Git::Attributes, seed_helper: true do it 'returns a Hash containing the attributes when a pattern is defined using an absolute path' do # When a path is given without a leading slash it should still match # patterns defined with a leading slash. - expect(subject.attributes('foo.png')) - .to eq({ 'gitlab-language' => 'png' }) + expect(subject.attributes('foo.png')). + to eq({ 'gitlab-language' => 'png' }) - expect(subject.attributes('/foo.png')) - .to eq({ 'gitlab-language' => 'png' }) + expect(subject.attributes('/foo.png')). + to eq({ 'gitlab-language' => 'png' }) end it 'returns an empty Hash for a defined path without attributes' do @@ -74,8 +74,8 @@ describe Gitlab::Git::Attributes, seed_helper: true do end it 'parses an entry that uses a tab to separate the pattern and attributes' do - expect(subject.patterns[File.join(path, '*.md')]) - .to eq({ 'gitlab-language' => 'markdown' }) + expect(subject.patterns[File.join(path, '*.md')]). + to eq({ 'gitlab-language' => 'markdown' }) end it 'stores patterns in reverse order' do @@ -91,9 +91,9 @@ describe Gitlab::Git::Attributes, seed_helper: true do end it 'does not parse anything when the attributes file does not exist' do - expect(File).to receive(:exist?) - .with(File.join(path, 'info/attributes')) - .and_return(false) + expect(File).to receive(:exist?). + with(File.join(path, 'info/attributes')). + and_return(false) expect(subject.patterns).to eq({}) end @@ -115,13 +115,13 @@ describe Gitlab::Git::Attributes, seed_helper: true do it 'parses multiple attributes' do input = 'boolean key=value -negated' - expect(subject.parse_attributes(input)) - .to eq({ 'boolean' => true, 'key' => 'value', 'negated' => false }) + expect(subject.parse_attributes(input)). + to eq({ 'boolean' => true, 'key' => 'value', 'negated' => false }) end it 'parses attributes with query string parameters' do - expect(subject.parse_attributes('foo=bar?baz=1')) - .to eq({ 'foo' => 'bar?baz=1' }) + expect(subject.parse_attributes('foo=bar?baz=1')). + to eq({ 'foo' => 'bar?baz=1' }) end end @@ -133,9 +133,9 @@ describe Gitlab::Git::Attributes, seed_helper: true do end it 'does not yield when the attributes file does not exist' do - expect(File).to receive(:exist?) - .with(File.join(path, 'info/attributes')) - .and_return(false) + expect(File).to receive(:exist?). + with(File.join(path, 'info/attributes')). + and_return(false) expect { |b| subject.each_line(&b) }.not_to yield_control end diff --git a/spec/lib/gitlab/git/blob_spec.rb b/spec/lib/gitlab/git/blob_spec.rb index 327aba9cae7..0c321f0343c 100644 --- a/spec/lib/gitlab/git/blob_spec.rb +++ b/spec/lib/gitlab/git/blob_spec.rb @@ -92,9 +92,9 @@ describe Gitlab::Git::Blob, seed_helper: true do end it 'marks the blob as binary' do - expect(Gitlab::Git::Blob).to receive(:new) - .with(hash_including(binary: true)) - .and_call_original + expect(Gitlab::Git::Blob).to receive(:new). + with(hash_including(binary: true)). + and_call_original expect(blob).to be_binary end diff --git a/spec/lib/gitlab/git/diff_collection_spec.rb b/spec/lib/gitlab/git/diff_collection_spec.rb index c6ff864268d..47bdd7310d5 100644 --- a/spec/lib/gitlab/git/diff_collection_spec.rb +++ b/spec/lib/gitlab/git/diff_collection_spec.rb @@ -309,8 +309,8 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do end it 'yields Diff instances even when they are too large' do - expect { |b| collection.each(&b) } - .to yield_with_args(an_instance_of(Gitlab::Git::Diff)) + expect { |b| collection.each(&b) }. + to yield_with_args(an_instance_of(Gitlab::Git::Diff)) end it 'prunes diffs that are too large' do @@ -331,8 +331,8 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do let(:no_collapse) { true } it 'yields Diff instances even when they are quite big' do - expect { |b| subject.each(&b) } - .to yield_with_args(an_instance_of(Gitlab::Git::Diff)) + expect { |b| subject.each(&b) }. + to yield_with_args(an_instance_of(Gitlab::Git::Diff)) end it 'does not prune diffs' do @@ -350,8 +350,8 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do let(:no_collapse) { false } it 'yields Diff instances even when they are quite big' do - expect { |b| subject.each(&b) } - .to yield_with_args(an_instance_of(Gitlab::Git::Diff)) + expect { |b| subject.each(&b) }. + to yield_with_args(an_instance_of(Gitlab::Git::Diff)) end it 'prunes diffs that are quite big' do @@ -437,8 +437,8 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do let(:all_diffs) { true } it 'yields Diff instances even when they are quite big' do - expect { |b| subject.each(&b) } - .to yield_with_args(an_instance_of(Gitlab::Git::Diff)) + expect { |b| subject.each(&b) }. + to yield_with_args(an_instance_of(Gitlab::Git::Diff)) end it 'does not prune diffs' do diff --git a/spec/lib/gitlab/git/diff_spec.rb b/spec/lib/gitlab/git/diff_spec.rb index 70d3b1a9f81..4c55532d165 100644 --- a/spec/lib/gitlab/git/diff_spec.rb +++ b/spec/lib/gitlab/git/diff_spec.rb @@ -70,8 +70,8 @@ EOT context 'using a diff that is too large' do it 'prunes the diff' do - expect_any_instance_of(String).to receive(:bytesize) - .and_return(1024 * 1024 * 1024) + expect_any_instance_of(String).to receive(:bytesize). + and_return(1024 * 1024 * 1024) diff = described_class.new(@rugged_diff) @@ -100,8 +100,8 @@ EOT context 'using a large binary diff' do it 'does not prune the diff' do - expect_any_instance_of(Rugged::Diff::Delta).to receive(:binary?) - .and_return(true) + expect_any_instance_of(Rugged::Diff::Delta).to receive(:binary?). + and_return(true) diff = described_class.new(@rugged_diff) diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 5e0c3a530e9..2a915bf426f 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -315,8 +315,8 @@ describe Gitlab::Git::Repository, seed_helper: true do end it "should move the tip of the master branch to the correct commit" do - new_tip = @normal_repo.rugged.references["refs/heads/master"] - .target.oid + new_tip = @normal_repo.rugged.references["refs/heads/master"]. + target.oid expect(new_tip).to eq(reset_commit) end diff --git a/spec/lib/gitlab/gitlab_import/importer_spec.rb b/spec/lib/gitlab/gitlab_import/importer_spec.rb index 4f588da0a83..9b499b593d3 100644 --- a/spec/lib/gitlab/gitlab_import/importer_spec.rb +++ b/spec/lib/gitlab/gitlab_import/importer_spec.rb @@ -45,8 +45,8 @@ describe Gitlab::GitlabImport::Importer, lib: true do def stub_request(path, body) url = "https://gitlab.com/api/v3/projects/asd%2Fvim/#{path}?page=1&per_page=100" - WebMock.stub_request(:get, url) - .to_return( + WebMock.stub_request(:get, url). + to_return( headers: { 'Content-Type' => 'application/json' }, body: body ) diff --git a/spec/lib/gitlab/identifier_spec.rb b/spec/lib/gitlab/identifier_spec.rb index 29912da2e25..bb758a8a202 100644 --- a/spec/lib/gitlab/identifier_spec.rb +++ b/spec/lib/gitlab/identifier_spec.rb @@ -12,8 +12,8 @@ describe Gitlab::Identifier do describe '#identify' do context 'without an identifier' do it 'identifies the user using a commit' do - expect(identifier).to receive(:identify_using_commit) - .with(project, '123') + expect(identifier).to receive(:identify_using_commit). + with(project, '123') identifier.identify('', project, '123') end @@ -21,8 +21,8 @@ describe Gitlab::Identifier do context 'with a user identifier' do it 'identifies the user using a user ID' do - expect(identifier).to receive(:identify_using_user) - .with("user-#{user.id}") + expect(identifier).to receive(:identify_using_user). + with("user-#{user.id}") identifier.identify("user-#{user.id}", project, '123') end @@ -30,8 +30,8 @@ describe Gitlab::Identifier do context 'with an SSH key identifier' do it 'identifies the user using an SSH key ID' do - expect(identifier).to receive(:identify_using_ssh_key) - .with("key-#{key.id}") + expect(identifier).to receive(:identify_using_ssh_key). + with("key-#{key.id}") identifier.identify("key-#{key.id}", project, '123') end diff --git a/spec/lib/gitlab/import_export/avatar_restorer_spec.rb b/spec/lib/gitlab/import_export/avatar_restorer_spec.rb index 08a42fd27a2..c141762421f 100644 --- a/spec/lib/gitlab/import_export/avatar_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/avatar_restorer_spec.rb @@ -7,8 +7,8 @@ describe Gitlab::ImportExport::AvatarRestorer, lib: true do let(:project) { create(:empty_project) } before do - allow_any_instance_of(described_class).to receive(:avatar_export_file) - .and_return(uploaded_image_temp_path) + allow_any_instance_of(described_class).to receive(:avatar_export_file). + and_return(uploaded_image_temp_path) end after do diff --git a/spec/lib/gitlab/incoming_email_spec.rb b/spec/lib/gitlab/incoming_email_spec.rb index 698bd72d0f8..d54753ccf90 100644 --- a/spec/lib/gitlab/incoming_email_spec.rb +++ b/spec/lib/gitlab/incoming_email_spec.rb @@ -99,10 +99,10 @@ describe Gitlab::IncomingEmail, lib: true do end it 'returns reply key' do - expect(described_class.scan_fallback_references(references)) - .to eq(%w[issue_1@localhost - reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost - exchange@microsoft.com]) + expect(described_class.scan_fallback_references(references)). + to eq(%w[issue_1@localhost + reply-59d8df8370b7e95c5a49fbf86aeb2c93@localhost + exchange@microsoft.com]) end end end diff --git a/spec/lib/gitlab/job_waiter_spec.rb b/spec/lib/gitlab/job_waiter_spec.rb index 6186cec2689..780f5b1f8d7 100644 --- a/spec/lib/gitlab/job_waiter_spec.rb +++ b/spec/lib/gitlab/job_waiter_spec.rb @@ -4,8 +4,8 @@ describe Gitlab::JobWaiter do describe '#wait' do let(:waiter) { described_class.new(%w(a)) } it 'returns when all jobs have been completed' do - expect(Gitlab::SidekiqStatus).to receive(:all_completed?).with(%w(a)) - .and_return(true) + expect(Gitlab::SidekiqStatus).to receive(:all_completed?).with(%w(a)). + and_return(true) expect(waiter).not_to receive(:sleep) @@ -13,9 +13,9 @@ describe Gitlab::JobWaiter do end it 'sleeps between checking the job statuses' do - expect(Gitlab::SidekiqStatus).to receive(:all_completed?) - .with(%w(a)) - .and_return(false, true) + expect(Gitlab::SidekiqStatus).to receive(:all_completed?). + with(%w(a)). + and_return(false, true) expect(waiter).to receive(:sleep).with(described_class::INTERVAL) diff --git a/spec/lib/gitlab/ldap/adapter_spec.rb b/spec/lib/gitlab/ldap/adapter_spec.rb index 563c074017a..fe3709f30e1 100644 --- a/spec/lib/gitlab/ldap/adapter_spec.rb +++ b/spec/lib/gitlab/ldap/adapter_spec.rb @@ -34,8 +34,8 @@ describe Gitlab::LDAP::Adapter, lib: true do end it 'searches with the proper options when searching with a limit' do - expect(adapter) - .to receive(:ldap_search).with(hash_including(size: 100)).and_return({}) + expect(adapter). + to receive(:ldap_search).with(hash_including(size: 100)).and_return({}) adapter.users('uid', 'johndoe', 100) end diff --git a/spec/lib/gitlab/ldap/authentication_spec.rb b/spec/lib/gitlab/ldap/authentication_spec.rb index f689b47fec4..b8f3290e84c 100644 --- a/spec/lib/gitlab/ldap/authentication_spec.rb +++ b/spec/lib/gitlab/ldap/authentication_spec.rb @@ -16,8 +16,8 @@ describe Gitlab::LDAP::Authentication, lib: true do # try only to fake the LDAP call adapter = double('adapter', dn: dn).as_null_object - allow_any_instance_of(described_class) - .to receive(:adapter).and_return(adapter) + allow_any_instance_of(described_class). + to receive(:adapter).and_return(adapter) expect(described_class.login(login, password)).to be_truthy end @@ -25,8 +25,8 @@ describe Gitlab::LDAP::Authentication, lib: true do it "is false if the user does not exist" do # try only to fake the LDAP call adapter = double('adapter', dn: dn).as_null_object - allow_any_instance_of(described_class) - .to receive(:adapter).and_return(adapter) + allow_any_instance_of(described_class). + to receive(:adapter).and_return(adapter) expect(described_class.login(login, password)).to be_falsey end @@ -36,8 +36,8 @@ describe Gitlab::LDAP::Authentication, lib: true do # try only to fake the LDAP call adapter = double('adapter', bind_as: nil).as_null_object - allow_any_instance_of(described_class) - .to receive(:adapter).and_return(adapter) + allow_any_instance_of(described_class). + to receive(:adapter).and_return(adapter) expect(described_class.login(login, password)).to be_falsey end diff --git a/spec/lib/gitlab/ldap/user_spec.rb b/spec/lib/gitlab/ldap/user_spec.rb index 5c56c210123..89790c9e1af 100644 --- a/spec/lib/gitlab/ldap/user_spec.rb +++ b/spec/lib/gitlab/ldap/user_spec.rb @@ -138,8 +138,8 @@ describe Gitlab::LDAP::User, lib: true do describe 'blocking' do def configure_block(value) - allow_any_instance_of(Gitlab::LDAP::Config) - .to receive(:block_auto_created_users).and_return(value) + allow_any_instance_of(Gitlab::LDAP::Config). + to receive(:block_auto_created_users).and_return(value) end context 'signup' do diff --git a/spec/lib/gitlab/metrics/instrumentation_spec.rb b/spec/lib/gitlab/metrics/instrumentation_spec.rb index 4b19ee19103..a986cb520fb 100644 --- a/spec/lib/gitlab/metrics/instrumentation_spec.rb +++ b/spec/lib/gitlab/metrics/instrumentation_spec.rb @@ -78,11 +78,11 @@ describe Gitlab::Metrics::Instrumentation do end it 'tracks the call duration upon calling the method' do - allow(Gitlab::Metrics).to receive(:method_call_threshold) - .and_return(0) + allow(Gitlab::Metrics).to receive(:method_call_threshold). + and_return(0) - allow(described_class).to receive(:transaction) - .and_return(transaction) + allow(described_class).to receive(:transaction). + and_return(transaction) expect_any_instance_of(Gitlab::Metrics::MethodCall).to receive(:measure) @@ -90,8 +90,8 @@ describe Gitlab::Metrics::Instrumentation do end it 'does not track method calls below a given duration threshold' do - allow(Gitlab::Metrics).to receive(:method_call_threshold) - .and_return(100) + allow(Gitlab::Metrics).to receive(:method_call_threshold). + and_return(100) expect(transaction).not_to receive(:add_metric) @@ -137,8 +137,8 @@ describe Gitlab::Metrics::Instrumentation do before do allow(Gitlab::Metrics).to receive(:enabled?).and_return(true) - described_class - .instrument_instance_method(@dummy, :bar) + described_class. + instrument_instance_method(@dummy, :bar) end it 'instruments instances of the Class' do @@ -156,11 +156,11 @@ describe Gitlab::Metrics::Instrumentation do end it 'tracks the call duration upon calling the method' do - allow(Gitlab::Metrics).to receive(:method_call_threshold) - .and_return(0) + allow(Gitlab::Metrics).to receive(:method_call_threshold). + and_return(0) - allow(described_class).to receive(:transaction) - .and_return(transaction) + allow(described_class).to receive(:transaction). + and_return(transaction) expect_any_instance_of(Gitlab::Metrics::MethodCall).to receive(:measure) @@ -168,8 +168,8 @@ describe Gitlab::Metrics::Instrumentation do end it 'does not track method calls below a given duration threshold' do - allow(Gitlab::Metrics).to receive(:method_call_threshold) - .and_return(100) + allow(Gitlab::Metrics).to receive(:method_call_threshold). + and_return(100) expect(transaction).not_to receive(:add_metric) @@ -183,8 +183,8 @@ describe Gitlab::Metrics::Instrumentation do end it 'does not instrument the method' do - described_class - .instrument_instance_method(@dummy, :bar) + described_class. + instrument_instance_method(@dummy, :bar) expect(described_class.instrumented?(@dummy)).to eq(false) end diff --git a/spec/lib/gitlab/metrics/rack_middleware_spec.rb b/spec/lib/gitlab/metrics/rack_middleware_spec.rb index ec415f2bd85..fb470ea7568 100644 --- a/spec/lib/gitlab/metrics/rack_middleware_spec.rb +++ b/spec/lib/gitlab/metrics/rack_middleware_spec.rb @@ -26,8 +26,8 @@ describe Gitlab::Metrics::RackMiddleware do allow(app).to receive(:call).with(env) - expect(middleware).to receive(:tag_controller) - .with(an_instance_of(Gitlab::Metrics::Transaction), env) + expect(middleware).to receive(:tag_controller). + with(an_instance_of(Gitlab::Metrics::Transaction), env) middleware.call(env) end @@ -40,8 +40,8 @@ describe Gitlab::Metrics::RackMiddleware do allow(app).to receive(:call).with(env) - expect(middleware).to receive(:tag_endpoint) - .with(an_instance_of(Gitlab::Metrics::Transaction), env) + expect(middleware).to receive(:tag_endpoint). + with(an_instance_of(Gitlab::Metrics::Transaction), env) middleware.call(env) end @@ -49,8 +49,8 @@ describe Gitlab::Metrics::RackMiddleware do it 'tracks any raised exceptions' do expect(app).to receive(:call).with(env).and_raise(RuntimeError) - expect_any_instance_of(Gitlab::Metrics::Transaction) - .to receive(:add_event).with(:rails_exception) + expect_any_instance_of(Gitlab::Metrics::Transaction). + to receive(:add_event).with(:rails_exception) expect { middleware.call(env) }.to raise_error(RuntimeError) end diff --git a/spec/lib/gitlab/metrics/sampler_spec.rb b/spec/lib/gitlab/metrics/sampler_spec.rb index d07ce6f81af..1ab923b58cf 100644 --- a/spec/lib/gitlab/metrics/sampler_spec.rb +++ b/spec/lib/gitlab/metrics/sampler_spec.rb @@ -38,8 +38,8 @@ describe Gitlab::Metrics::Sampler do describe '#flush' do it 'schedules the metrics using Sidekiq' do - expect(Gitlab::Metrics).to receive(:submit_metrics) - .with([an_instance_of(Hash)]) + expect(Gitlab::Metrics).to receive(:submit_metrics). + with([an_instance_of(Hash)]) sampler.sample_memory_usage sampler.flush @@ -48,12 +48,12 @@ describe Gitlab::Metrics::Sampler do describe '#sample_memory_usage' do it 'adds a metric containing the memory usage' do - expect(Gitlab::Metrics::System).to receive(:memory_usage) - .and_return(9000) + expect(Gitlab::Metrics::System).to receive(:memory_usage). + and_return(9000) - expect(sampler).to receive(:add_metric) - .with(/memory_usage/, value: 9000) - .and_call_original + expect(sampler).to receive(:add_metric). + with(/memory_usage/, value: 9000). + and_call_original sampler.sample_memory_usage end @@ -61,12 +61,12 @@ describe Gitlab::Metrics::Sampler do describe '#sample_file_descriptors' do it 'adds a metric containing the amount of open file descriptors' do - expect(Gitlab::Metrics::System).to receive(:file_descriptor_count) - .and_return(4) + expect(Gitlab::Metrics::System).to receive(:file_descriptor_count). + and_return(4) - expect(sampler).to receive(:add_metric) - .with(/file_descriptors/, value: 4) - .and_call_original + expect(sampler).to receive(:add_metric). + with(/file_descriptors/, value: 4). + and_call_original sampler.sample_file_descriptors end @@ -75,10 +75,10 @@ describe Gitlab::Metrics::Sampler do if Gitlab::Metrics.mri? describe '#sample_objects' do it 'adds a metric containing the amount of allocated objects' do - expect(sampler).to receive(:add_metric) - .with(/object_counts/, an_instance_of(Hash), an_instance_of(Hash)) - .at_least(:once) - .and_call_original + expect(sampler).to receive(:add_metric). + with(/object_counts/, an_instance_of(Hash), an_instance_of(Hash)). + at_least(:once). + and_call_original sampler.sample_objects end @@ -86,8 +86,8 @@ describe Gitlab::Metrics::Sampler do it 'ignores classes without a name' do expect(Allocations).to receive(:to_hash).and_return({ Class.new => 4 }) - expect(sampler).not_to receive(:add_metric) - .with('object_counts', an_instance_of(Hash), type: nil) + expect(sampler).not_to receive(:add_metric). + with('object_counts', an_instance_of(Hash), type: nil) sampler.sample_objects end @@ -98,9 +98,9 @@ describe Gitlab::Metrics::Sampler do it 'adds a metric containing garbage collection statistics' do expect(GC::Profiler).to receive(:total_time).and_return(0.24) - expect(sampler).to receive(:add_metric) - .with(/gc_statistics/, an_instance_of(Hash)) - .and_call_original + expect(sampler).to receive(:add_metric). + with(/gc_statistics/, an_instance_of(Hash)). + and_call_original sampler.sample_gc end @@ -110,9 +110,9 @@ describe Gitlab::Metrics::Sampler do it 'prefixes the series name for a Rails process' do expect(sampler).to receive(:sidekiq?).and_return(false) - expect(Gitlab::Metrics::Metric).to receive(:new) - .with('rails_cats', { value: 10 }, {}) - .and_call_original + expect(Gitlab::Metrics::Metric).to receive(:new). + with('rails_cats', { value: 10 }, {}). + and_call_original sampler.add_metric('cats', value: 10) end @@ -120,9 +120,9 @@ describe Gitlab::Metrics::Sampler do it 'prefixes the series name for a Sidekiq process' do expect(sampler).to receive(:sidekiq?).and_return(true) - expect(Gitlab::Metrics::Metric).to receive(:new) - .with('sidekiq_cats', { value: 10 }, {}) - .and_call_original + expect(Gitlab::Metrics::Metric).to receive(:new). + with('sidekiq_cats', { value: 10 }, {}). + and_call_original sampler.add_metric('cats', value: 10) end diff --git a/spec/lib/gitlab/metrics/sidekiq_middleware_spec.rb b/spec/lib/gitlab/metrics/sidekiq_middleware_spec.rb index b576d7173f5..acaba785606 100644 --- a/spec/lib/gitlab/metrics/sidekiq_middleware_spec.rb +++ b/spec/lib/gitlab/metrics/sidekiq_middleware_spec.rb @@ -8,12 +8,12 @@ describe Gitlab::Metrics::SidekiqMiddleware do it 'tracks the transaction' do worker = double(:worker, class: double(:class, name: 'TestWorker')) - expect(Gitlab::Metrics::Transaction).to receive(:new) - .with('TestWorker#perform') - .and_call_original + expect(Gitlab::Metrics::Transaction).to receive(:new). + with('TestWorker#perform'). + and_call_original - expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:set) - .with(:sidekiq_queue_duration, instance_of(Float)) + expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:set). + with(:sidekiq_queue_duration, instance_of(Float)) expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:finish) @@ -23,12 +23,12 @@ describe Gitlab::Metrics::SidekiqMiddleware do it 'tracks the transaction (for messages without `enqueued_at`)' do worker = double(:worker, class: double(:class, name: 'TestWorker')) - expect(Gitlab::Metrics::Transaction).to receive(:new) - .with('TestWorker#perform') - .and_call_original + expect(Gitlab::Metrics::Transaction).to receive(:new). + with('TestWorker#perform'). + and_call_original - expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:set) - .with(:sidekiq_queue_duration, instance_of(Float)) + expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:set). + with(:sidekiq_queue_duration, instance_of(Float)) expect_any_instance_of(Gitlab::Metrics::Transaction).to receive(:finish) @@ -38,17 +38,17 @@ describe Gitlab::Metrics::SidekiqMiddleware do it 'tracks any raised exceptions' do worker = double(:worker, class: double(:class, name: 'TestWorker')) - expect_any_instance_of(Gitlab::Metrics::Transaction) - .to receive(:run).and_raise(RuntimeError) + expect_any_instance_of(Gitlab::Metrics::Transaction). + to receive(:run).and_raise(RuntimeError) - expect_any_instance_of(Gitlab::Metrics::Transaction) - .to receive(:add_event).with(:sidekiq_exception) + expect_any_instance_of(Gitlab::Metrics::Transaction). + to receive(:add_event).with(:sidekiq_exception) - expect_any_instance_of(Gitlab::Metrics::Transaction) - .to receive(:finish) + expect_any_instance_of(Gitlab::Metrics::Transaction). + to receive(:finish) - expect { middleware.call(worker, message, :test) } - .to raise_error(RuntimeError) + expect { middleware.call(worker, message, :test) }. + to raise_error(RuntimeError) end end end diff --git a/spec/lib/gitlab/metrics/subscribers/action_view_spec.rb b/spec/lib/gitlab/metrics/subscribers/action_view_spec.rb index e7b595405a8..0695c5ce096 100644 --- a/spec/lib/gitlab/metrics/subscribers/action_view_spec.rb +++ b/spec/lib/gitlab/metrics/subscribers/action_view_spec.rb @@ -21,11 +21,11 @@ describe Gitlab::Metrics::Subscribers::ActionView do values = { duration: 2.1 } tags = { view: 'app/views/x.html.haml' } - expect(transaction).to receive(:increment) - .with(:view_duration, 2.1) + expect(transaction).to receive(:increment). + with(:view_duration, 2.1) - expect(transaction).to receive(:add_metric) - .with(described_class::SERIES, values, tags) + expect(transaction).to receive(:add_metric). + with(described_class::SERIES, values, tags) subscriber.render_template(event) end diff --git a/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb b/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb index ce6587e993f..49699ffe28f 100644 --- a/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb +++ b/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb @@ -12,8 +12,8 @@ describe Gitlab::Metrics::Subscribers::ActiveRecord do describe '#sql' do describe 'without a current transaction' do it 'simply returns' do - expect_any_instance_of(Gitlab::Metrics::Transaction) - .not_to receive(:increment) + expect_any_instance_of(Gitlab::Metrics::Transaction). + not_to receive(:increment) subscriber.sql(event) end @@ -21,15 +21,15 @@ describe Gitlab::Metrics::Subscribers::ActiveRecord do describe 'with a current transaction' do it 'increments the :sql_duration value' do - expect(subscriber).to receive(:current_transaction) - .at_least(:once) - .and_return(transaction) + expect(subscriber).to receive(:current_transaction). + at_least(:once). + and_return(transaction) - expect(transaction).to receive(:increment) - .with(:sql_duration, 0.2) + expect(transaction).to receive(:increment). + with(:sql_duration, 0.2) - expect(transaction).to receive(:increment) - .with(:sql_count, 1) + expect(transaction).to receive(:increment). + with(:sql_count, 1) subscriber.sql(event) end diff --git a/spec/lib/gitlab/metrics/subscribers/rails_cache_spec.rb b/spec/lib/gitlab/metrics/subscribers/rails_cache_spec.rb index f04dc8dcc02..d986c6fac43 100644 --- a/spec/lib/gitlab/metrics/subscribers/rails_cache_spec.rb +++ b/spec/lib/gitlab/metrics/subscribers/rails_cache_spec.rb @@ -8,26 +8,26 @@ describe Gitlab::Metrics::Subscribers::RailsCache do describe '#cache_read' do it 'increments the cache_read duration' do - expect(subscriber).to receive(:increment) - .with(:cache_read, event.duration) + expect(subscriber).to receive(:increment). + with(:cache_read, event.duration) subscriber.cache_read(event) end context 'with a transaction' do before do - allow(subscriber).to receive(:current_transaction) - .and_return(transaction) + allow(subscriber).to receive(:current_transaction). + and_return(transaction) end context 'with hit event' do let(:event) { double(:event, duration: 15.2, payload: { hit: true }) } it 'increments the cache_read_hit count' do - expect(transaction).to receive(:increment) - .with(:cache_read_hit_count, 1) - expect(transaction).to receive(:increment) - .with(any_args).at_least(1) # Other calls + expect(transaction).to receive(:increment). + with(:cache_read_hit_count, 1) + expect(transaction).to receive(:increment). + with(any_args).at_least(1) # Other calls subscriber.cache_read(event) end @@ -36,8 +36,8 @@ describe Gitlab::Metrics::Subscribers::RailsCache do let(:event) { double(:event, duration: 15.2, payload: { hit: true, super_operation: :fetch }) } it 'does not increment cache read miss' do - expect(transaction).not_to receive(:increment) - .with(:cache_read_hit_count, 1) + expect(transaction).not_to receive(:increment). + with(:cache_read_hit_count, 1) subscriber.cache_read(event) end @@ -48,10 +48,10 @@ describe Gitlab::Metrics::Subscribers::RailsCache do let(:event) { double(:event, duration: 15.2, payload: { hit: false }) } it 'increments the cache_read_miss count' do - expect(transaction).to receive(:increment) - .with(:cache_read_miss_count, 1) - expect(transaction).to receive(:increment) - .with(any_args).at_least(1) # Other calls + expect(transaction).to receive(:increment). + with(:cache_read_miss_count, 1) + expect(transaction).to receive(:increment). + with(any_args).at_least(1) # Other calls subscriber.cache_read(event) end @@ -60,8 +60,8 @@ describe Gitlab::Metrics::Subscribers::RailsCache do let(:event) { double(:event, duration: 15.2, payload: { hit: false, super_operation: :fetch }) } it 'does not increment cache read miss' do - expect(transaction).not_to receive(:increment) - .with(:cache_read_miss_count, 1) + expect(transaction).not_to receive(:increment). + with(:cache_read_miss_count, 1) subscriber.cache_read(event) end @@ -72,8 +72,8 @@ describe Gitlab::Metrics::Subscribers::RailsCache do describe '#cache_write' do it 'increments the cache_write duration' do - expect(subscriber).to receive(:increment) - .with(:cache_write, event.duration) + expect(subscriber).to receive(:increment). + with(:cache_write, event.duration) subscriber.cache_write(event) end @@ -81,8 +81,8 @@ describe Gitlab::Metrics::Subscribers::RailsCache do describe '#cache_delete' do it 'increments the cache_delete duration' do - expect(subscriber).to receive(:increment) - .with(:cache_delete, event.duration) + expect(subscriber).to receive(:increment). + with(:cache_delete, event.duration) subscriber.cache_delete(event) end @@ -90,8 +90,8 @@ describe Gitlab::Metrics::Subscribers::RailsCache do describe '#cache_exist?' do it 'increments the cache_exists duration' do - expect(subscriber).to receive(:increment) - .with(:cache_exists, event.duration) + expect(subscriber).to receive(:increment). + with(:cache_exists, event.duration) subscriber.cache_exist?(event) end @@ -108,13 +108,13 @@ describe Gitlab::Metrics::Subscribers::RailsCache do context 'with a transaction' do before do - allow(subscriber).to receive(:current_transaction) - .and_return(transaction) + allow(subscriber).to receive(:current_transaction). + and_return(transaction) end it 'increments the cache_read_hit count' do - expect(transaction).to receive(:increment) - .with(:cache_read_hit_count, 1) + expect(transaction).to receive(:increment). + with(:cache_read_hit_count, 1) subscriber.cache_fetch_hit(event) end @@ -132,13 +132,13 @@ describe Gitlab::Metrics::Subscribers::RailsCache do context 'with a transaction' do before do - allow(subscriber).to receive(:current_transaction) - .and_return(transaction) + allow(subscriber).to receive(:current_transaction). + and_return(transaction) end it 'increments the cache_fetch_miss count' do - expect(transaction).to receive(:increment) - .with(:cache_read_miss_count, 1) + expect(transaction).to receive(:increment). + with(:cache_read_miss_count, 1) subscriber.cache_generate(event) end @@ -156,22 +156,22 @@ describe Gitlab::Metrics::Subscribers::RailsCache do context 'with a transaction' do before do - allow(subscriber).to receive(:current_transaction) - .and_return(transaction) + allow(subscriber).to receive(:current_transaction). + and_return(transaction) end it 'increments the total and specific cache duration' do - expect(transaction).to receive(:increment) - .with(:cache_duration, event.duration) + expect(transaction).to receive(:increment). + with(:cache_duration, event.duration) - expect(transaction).to receive(:increment) - .with(:cache_count, 1) + expect(transaction).to receive(:increment). + with(:cache_count, 1) - expect(transaction).to receive(:increment) - .with(:cache_delete_duration, event.duration) + expect(transaction).to receive(:increment). + with(:cache_delete_duration, event.duration) - expect(transaction).to receive(:increment) - .with(:cache_delete_count, 1) + expect(transaction).to receive(:increment). + with(:cache_delete_count, 1) subscriber.increment(:cache_delete, event.duration) end diff --git a/spec/lib/gitlab/metrics/transaction_spec.rb b/spec/lib/gitlab/metrics/transaction_spec.rb index 3779af81512..0c5a6246d85 100644 --- a/spec/lib/gitlab/metrics/transaction_spec.rb +++ b/spec/lib/gitlab/metrics/transaction_spec.rb @@ -39,8 +39,8 @@ describe Gitlab::Metrics::Transaction do describe '#add_metric' do it 'adds a metric to the transaction' do - expect(Gitlab::Metrics::Metric).to receive(:new) - .with('rails_foo', { number: 10 }, {}) + expect(Gitlab::Metrics::Metric).to receive(:new). + with('rails_foo', { number: 10 }, {}) transaction.add_metric('foo', number: 10) end @@ -61,8 +61,8 @@ describe Gitlab::Metrics::Transaction do values = { duration: 0.0, time: 3, allocated_memory: a_kind_of(Numeric) } - expect(transaction).to receive(:add_metric) - .with('transactions', values, {}) + expect(transaction).to receive(:add_metric). + with('transactions', values, {}) transaction.track_self end @@ -78,8 +78,8 @@ describe Gitlab::Metrics::Transaction do allocated_memory: a_kind_of(Numeric) } - expect(transaction).to receive(:add_metric) - .with('transactions', values, {}) + expect(transaction).to receive(:add_metric). + with('transactions', values, {}) transaction.track_self end @@ -109,8 +109,8 @@ describe Gitlab::Metrics::Transaction do allocated_memory: a_kind_of(Numeric) } - expect(transaction).to receive(:add_metric) - .with('transactions', values, {}) + expect(transaction).to receive(:add_metric). + with('transactions', values, {}) transaction.track_self end @@ -120,8 +120,8 @@ describe Gitlab::Metrics::Transaction do it 'submits the metrics to Sidekiq' do transaction.track_self - expect(Gitlab::Metrics).to receive(:submit_metrics) - .with([an_instance_of(Hash)]) + expect(Gitlab::Metrics).to receive(:submit_metrics). + with([an_instance_of(Hash)]) transaction.submit end @@ -137,8 +137,8 @@ describe Gitlab::Metrics::Transaction do timestamp: a_kind_of(Integer) } - expect(Gitlab::Metrics).to receive(:submit_metrics) - .with([hash]) + expect(Gitlab::Metrics).to receive(:submit_metrics). + with([hash]) transaction.submit end @@ -154,8 +154,8 @@ describe Gitlab::Metrics::Transaction do timestamp: a_kind_of(Integer) } - expect(Gitlab::Metrics).to receive(:submit_metrics) - .with([hash]) + expect(Gitlab::Metrics).to receive(:submit_metrics). + with([hash]) transaction.submit end diff --git a/spec/lib/gitlab/metrics_spec.rb b/spec/lib/gitlab/metrics_spec.rb index c8d292f4566..ab6e311b1e8 100644 --- a/spec/lib/gitlab/metrics_spec.rb +++ b/spec/lib/gitlab/metrics_spec.rb @@ -28,8 +28,8 @@ describe Gitlab::Metrics do describe '.prepare_metrics' do it 'returns a Hash with the keys as Symbols' do - metrics = described_class - .prepare_metrics([{ 'values' => {}, 'tags' => {} }]) + metrics = described_class. + prepare_metrics([{ 'values' => {}, 'tags' => {} }]) expect(metrics).to eq([{ values: {}, tags: {} }]) end @@ -74,19 +74,19 @@ describe Gitlab::Metrics do let(:transaction) { Gitlab::Metrics::Transaction.new } before do - allow(Gitlab::Metrics).to receive(:current_transaction) - .and_return(transaction) + allow(Gitlab::Metrics).to receive(:current_transaction). + and_return(transaction) end it 'adds a metric to the current transaction' do - expect(transaction).to receive(:increment) - .with('foo_real_time', a_kind_of(Numeric)) + expect(transaction).to receive(:increment). + with('foo_real_time', a_kind_of(Numeric)) - expect(transaction).to receive(:increment) - .with('foo_cpu_time', a_kind_of(Numeric)) + expect(transaction).to receive(:increment). + with('foo_cpu_time', a_kind_of(Numeric)) - expect(transaction).to receive(:increment) - .with('foo_call_count', 1) + expect(transaction).to receive(:increment). + with('foo_call_count', 1) Gitlab::Metrics.measure(:foo) { 10 } end @@ -102,8 +102,8 @@ describe Gitlab::Metrics do describe '.tag_transaction' do context 'without a transaction' do it 'does nothing' do - expect_any_instance_of(Gitlab::Metrics::Transaction) - .not_to receive(:add_tag) + expect_any_instance_of(Gitlab::Metrics::Transaction). + not_to receive(:add_tag) Gitlab::Metrics.tag_transaction(:foo, 'bar') end @@ -113,11 +113,11 @@ describe Gitlab::Metrics do let(:transaction) { Gitlab::Metrics::Transaction.new } it 'adds the tag to the transaction' do - expect(Gitlab::Metrics).to receive(:current_transaction) - .and_return(transaction) + expect(Gitlab::Metrics).to receive(:current_transaction). + and_return(transaction) - expect(transaction).to receive(:add_tag) - .with(:foo, 'bar') + expect(transaction).to receive(:add_tag). + with(:foo, 'bar') Gitlab::Metrics.tag_transaction(:foo, 'bar') end @@ -127,8 +127,8 @@ describe Gitlab::Metrics do describe '.action=' do context 'without a transaction' do it 'does nothing' do - expect_any_instance_of(Gitlab::Metrics::Transaction) - .not_to receive(:action=) + expect_any_instance_of(Gitlab::Metrics::Transaction). + not_to receive(:action=) Gitlab::Metrics.action = 'foo' end @@ -138,8 +138,8 @@ describe Gitlab::Metrics do it 'sets the action of a transaction' do trans = Gitlab::Metrics::Transaction.new - expect(Gitlab::Metrics).to receive(:current_transaction) - .and_return(trans) + expect(Gitlab::Metrics).to receive(:current_transaction). + and_return(trans) expect(trans).to receive(:action=).with('foo') @@ -157,8 +157,8 @@ describe Gitlab::Metrics do describe '.add_event' do context 'without a transaction' do it 'does nothing' do - expect_any_instance_of(Gitlab::Metrics::Transaction) - .not_to receive(:add_event) + expect_any_instance_of(Gitlab::Metrics::Transaction). + not_to receive(:add_event) Gitlab::Metrics.add_event(:meow) end @@ -170,8 +170,8 @@ describe Gitlab::Metrics do expect(transaction).to receive(:add_event).with(:meow) - expect(Gitlab::Metrics).to receive(:current_transaction) - .and_return(transaction) + expect(Gitlab::Metrics).to receive(:current_transaction). + and_return(transaction) Gitlab::Metrics.add_event(:meow) end diff --git a/spec/lib/gitlab/o_auth/user_spec.rb b/spec/lib/gitlab/o_auth/user_spec.rb index c49d2b286ff..4de5991db37 100644 --- a/spec/lib/gitlab/o_auth/user_spec.rb +++ b/spec/lib/gitlab/o_auth/user_spec.rb @@ -188,8 +188,8 @@ describe Gitlab::OAuth::User, lib: true do oauth_user.save identities_as_hash = gl_user.identities.map { |id| { provider: id.provider, extern_uid: id.extern_uid } } - expect(identities_as_hash) - .to match_array( + expect(identities_as_hash). + to match_array( [ { provider: 'ldapmain', extern_uid: 'uid=user1,ou=People,dc=example' }, { provider: 'twitter', extern_uid: uid } diff --git a/spec/lib/gitlab/route_map_spec.rb b/spec/lib/gitlab/route_map_spec.rb index 21c00c6e5b8..2370f56a613 100644 --- a/spec/lib/gitlab/route_map_spec.rb +++ b/spec/lib/gitlab/route_map_spec.rb @@ -4,43 +4,43 @@ describe Gitlab::RouteMap, lib: true do describe '#initialize' do context 'when the data is not YAML' do it 'raises an error' do - expect { described_class.new('"') } - .to raise_error(Gitlab::RouteMap::FormatError, /valid YAML/) + expect { described_class.new('"') }. + to raise_error(Gitlab::RouteMap::FormatError, /valid YAML/) end end context 'when the data is not a YAML array' do it 'raises an error' do - expect { described_class.new(YAML.dump('foo')) } - .to raise_error(Gitlab::RouteMap::FormatError, /an array/) + expect { described_class.new(YAML.dump('foo')) }. + to raise_error(Gitlab::RouteMap::FormatError, /an array/) end end context 'when an entry is not a hash' do it 'raises an error' do - expect { described_class.new(YAML.dump(['foo'])) } - .to raise_error(Gitlab::RouteMap::FormatError, /a hash/) + expect { described_class.new(YAML.dump(['foo'])) }. + to raise_error(Gitlab::RouteMap::FormatError, /a hash/) end end context 'when an entry does not have a source key' do it 'raises an error' do - expect { described_class.new(YAML.dump([{ 'public' => 'index.html' }])) } - .to raise_error(Gitlab::RouteMap::FormatError, /source key/) + expect { described_class.new(YAML.dump([{ 'public' => 'index.html' }])) }. + to raise_error(Gitlab::RouteMap::FormatError, /source key/) end end context 'when an entry does not have a public key' do it 'raises an error' do - expect { described_class.new(YAML.dump([{ 'source' => '/index\.html/' }])) } - .to raise_error(Gitlab::RouteMap::FormatError, /public key/) + expect { described_class.new(YAML.dump([{ 'source' => '/index\.html/' }])) }. + to raise_error(Gitlab::RouteMap::FormatError, /public key/) end end context 'when an entry source is not a valid regex' do it 'raises an error' do - expect { described_class.new(YAML.dump([{ 'source' => '/[/', 'public' => 'index.html' }])) } - .to raise_error(Gitlab::RouteMap::FormatError, /regular expression/) + expect { described_class.new(YAML.dump([{ 'source' => '/[/', 'public' => 'index.html' }])) }. + to raise_error(Gitlab::RouteMap::FormatError, /regular expression/) end end diff --git a/spec/lib/gitlab/serializer/pagination_spec.rb b/spec/lib/gitlab/serializer/pagination_spec.rb index 519eb1b274f..e05160da7a6 100644 --- a/spec/lib/gitlab/serializer/pagination_spec.rb +++ b/spec/lib/gitlab/serializer/pagination_spec.rb @@ -6,11 +6,11 @@ describe Gitlab::Serializer::Pagination do let(:headers) { spy('headers') } before do - allow(request).to receive(:query_parameters) - .and_return(params) + allow(request).to receive(:query_parameters). + and_return(params) - allow(response).to receive(:headers) - .and_return(headers) + allow(response).to receive(:headers). + and_return(headers) end let(:pagination) { described_class.new(request, response) } diff --git a/spec/lib/gitlab/sherlock/file_sample_spec.rb b/spec/lib/gitlab/sherlock/file_sample_spec.rb index 4989d14def3..cadf8bbce78 100644 --- a/spec/lib/gitlab/sherlock/file_sample_spec.rb +++ b/spec/lib/gitlab/sherlock/file_sample_spec.rb @@ -35,8 +35,8 @@ describe Gitlab::Sherlock::FileSample, lib: true do describe '#relative_path' do it 'returns the relative path' do - expect(sample.relative_path) - .to eq('spec/lib/gitlab/sherlock/file_sample_spec.rb') + expect(sample.relative_path). + to eq('spec/lib/gitlab/sherlock/file_sample_spec.rb') end end diff --git a/spec/lib/gitlab/sherlock/line_profiler_spec.rb b/spec/lib/gitlab/sherlock/line_profiler_spec.rb index 39c6b2a4844..d57627bba2b 100644 --- a/spec/lib/gitlab/sherlock/line_profiler_spec.rb +++ b/spec/lib/gitlab/sherlock/line_profiler_spec.rb @@ -20,9 +20,9 @@ describe Gitlab::Sherlock::LineProfiler, lib: true do describe '#profile_mri' do it 'returns an Array containing the return value and profiling samples' do - allow(profiler).to receive(:lineprof) - .and_yield - .and_return({ __FILE__ => [[0, 0, 0, 0]] }) + allow(profiler).to receive(:lineprof). + and_yield. + and_return({ __FILE__ => [[0, 0, 0, 0]] }) retval, samples = profiler.profile_mri { 42 } diff --git a/spec/lib/gitlab/sherlock/middleware_spec.rb b/spec/lib/gitlab/sherlock/middleware_spec.rb index b98ab0b14a2..2bbeb25ce98 100644 --- a/spec/lib/gitlab/sherlock/middleware_spec.rb +++ b/spec/lib/gitlab/sherlock/middleware_spec.rb @@ -72,8 +72,8 @@ describe Gitlab::Sherlock::Middleware, lib: true do 'REQUEST_URI' => '/cats' } - expect(middleware.transaction_from_env(env)) - .to be_an_instance_of(Gitlab::Sherlock::Transaction) + expect(middleware.transaction_from_env(env)). + to be_an_instance_of(Gitlab::Sherlock::Transaction) end end end diff --git a/spec/lib/gitlab/sherlock/query_spec.rb b/spec/lib/gitlab/sherlock/query_spec.rb index d97b5eef573..0a620428138 100644 --- a/spec/lib/gitlab/sherlock/query_spec.rb +++ b/spec/lib/gitlab/sherlock/query_spec.rb @@ -13,8 +13,8 @@ describe Gitlab::Sherlock::Query, lib: true do sql = 'SELECT COUNT(*) FROM users WHERE id = $1' bindings = [[double(:column), 10]] - query = described_class - .new_with_bindings(sql, bindings, started_at, finished_at) + query = described_class. + new_with_bindings(sql, bindings, started_at, finished_at) expect(query.query).to eq('SELECT COUNT(*) FROM users WHERE id = 10;') end diff --git a/spec/lib/gitlab/sherlock/transaction_spec.rb b/spec/lib/gitlab/sherlock/transaction_spec.rb index 6ae1aa20ea7..9fe18f253f0 100644 --- a/spec/lib/gitlab/sherlock/transaction_spec.rb +++ b/spec/lib/gitlab/sherlock/transaction_spec.rb @@ -109,8 +109,8 @@ describe Gitlab::Sherlock::Transaction, lib: true do query1 = Gitlab::Sherlock::Query.new('SELECT 1', start_time, start_time) - query2 = Gitlab::Sherlock::Query - .new('SELECT 2', start_time, start_time + 5) + query2 = Gitlab::Sherlock::Query. + new('SELECT 2', start_time, start_time + 5) transaction.queries << query1 transaction.queries << query2 @@ -162,11 +162,11 @@ describe Gitlab::Sherlock::Transaction, lib: true do describe '#profile_lines' do describe 'when line profiling is enabled' do it 'yields the block using the line profiler' do - allow(Gitlab::Sherlock).to receive(:enable_line_profiler?) - .and_return(true) + allow(Gitlab::Sherlock).to receive(:enable_line_profiler?). + and_return(true) - allow_any_instance_of(Gitlab::Sherlock::LineProfiler) - .to receive(:profile).and_return('cats are amazing', []) + allow_any_instance_of(Gitlab::Sherlock::LineProfiler). + to receive(:profile).and_return('cats are amazing', []) retval = transaction.profile_lines { 'cats are amazing' } @@ -176,8 +176,8 @@ describe Gitlab::Sherlock::Transaction, lib: true do describe 'when line profiling is disabled' do it 'yields the block' do - allow(Gitlab::Sherlock).to receive(:enable_line_profiler?) - .and_return(false) + allow(Gitlab::Sherlock).to receive(:enable_line_profiler?). + and_return(false) retval = transaction.profile_lines { 'cats are amazing' } @@ -196,8 +196,8 @@ describe Gitlab::Sherlock::Transaction, lib: true do end it 'tracks executed queries' do - expect(transaction).to receive(:track_query) - .with('SELECT 1', [], time, time) + expect(transaction).to receive(:track_query). + with('SELECT 1', [], time, time) subscription.publish('test', time, time, nil, query_data) end @@ -205,8 +205,8 @@ describe Gitlab::Sherlock::Transaction, lib: true do it 'only tracks queries triggered from the transaction thread' do expect(transaction).not_to receive(:track_query) - Thread.new { subscription.publish('test', time, time, nil, query_data) } - .join + Thread.new { subscription.publish('test', time, time, nil, query_data) }. + join end end @@ -228,8 +228,8 @@ describe Gitlab::Sherlock::Transaction, lib: true do it 'only tracks views rendered from the transaction thread' do expect(transaction).not_to receive(:track_view) - Thread.new { subscription.publish('test', time, time, nil, view_data) } - .join + Thread.new { subscription.publish('test', time, time, nil, view_data) }. + join end end end diff --git a/spec/lib/gitlab/sidekiq_status/client_middleware_spec.rb b/spec/lib/gitlab/sidekiq_status/client_middleware_spec.rb index 5faa5597aa5..287bf62d9bd 100644 --- a/spec/lib/gitlab/sidekiq_status/client_middleware_spec.rb +++ b/spec/lib/gitlab/sidekiq_status/client_middleware_spec.rb @@ -5,8 +5,8 @@ describe Gitlab::SidekiqStatus::ClientMiddleware do it 'tracks the job in Redis' do expect(Gitlab::SidekiqStatus).to receive(:set).with('123') - described_class.new - .call('Foo', { 'jid' => '123' }, double(:queue), double(:pool)) { nil } + described_class.new. + call('Foo', { 'jid' => '123' }, double(:queue), double(:pool)) { nil } end end end diff --git a/spec/lib/gitlab/sidekiq_status/server_middleware_spec.rb b/spec/lib/gitlab/sidekiq_status/server_middleware_spec.rb index 04e09d3dec8..80728197b8c 100644 --- a/spec/lib/gitlab/sidekiq_status/server_middleware_spec.rb +++ b/spec/lib/gitlab/sidekiq_status/server_middleware_spec.rb @@ -5,8 +5,8 @@ describe Gitlab::SidekiqStatus::ServerMiddleware do it 'stops tracking of a job upon completion' do expect(Gitlab::SidekiqStatus).to receive(:unset).with('123') - ret = described_class.new - .call(double(:worker), { 'jid' => '123' }, double(:queue)) { 10 } + ret = described_class.new. + call(double(:worker), { 'jid' => '123' }, double(:queue)) { 10 } expect(ret).to eq(10) end diff --git a/spec/lib/gitlab/url_builder_spec.rb b/spec/lib/gitlab/url_builder_spec.rb index 027d832308c..3fe8cf43934 100644 --- a/spec/lib/gitlab/url_builder_spec.rb +++ b/spec/lib/gitlab/url_builder_spec.rb @@ -101,8 +101,8 @@ describe Gitlab::UrlBuilder, lib: true do it 'returns a proper URL' do project = build_stubbed(:empty_project) - expect { described_class.build(project) } - .to raise_error(NotImplementedError, 'No URL builder defined for Project') + expect { described_class.build(project) }. + to raise_error(NotImplementedError, 'No URL builder defined for Project') end end end diff --git a/spec/lib/gitlab/view/presenter/delegated_spec.rb b/spec/lib/gitlab/view/presenter/delegated_spec.rb index 940a2ce6ebd..e9d4af54389 100644 --- a/spec/lib/gitlab/view/presenter/delegated_spec.rb +++ b/spec/lib/gitlab/view/presenter/delegated_spec.rb @@ -18,8 +18,8 @@ describe Gitlab::View::Presenter::Delegated do end it 'raise an error if the presentee already respond to method' do - expect { presenter_class.new(project, user: 'Jane Doe') } - .to raise_error Gitlab::View::Presenter::CannotOverrideMethodError + expect { presenter_class.new(project, user: 'Jane Doe') }. + to raise_error Gitlab::View::Presenter::CannotOverrideMethodError end end |