diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-08-10 18:31:42 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-08-10 19:29:42 -0400 |
commit | c8b802471bcb6ea9ea7af3c7a139598a1f945230 (patch) | |
tree | fb3fe5c094d8a831ede19d4ff2f1471914744907 /spec/lib/gitlab | |
parent | 4ef10795ce5e24dc0f905daeb7236fe707a8c195 (diff) | |
download | gitlab-ce-c8b802471bcb6ea9ea7af3c7a139598a1f945230.tar.gz |
Enable the RSpec/HookArgument cop and auto-correct offenses
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/daemon_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/data_builder/note_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/git/diff_collection_spec.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 16 | ||||
-rw-r--r-- | spec/lib/gitlab/git/storage/circuit_breaker_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/health_checks/fs_shards_check_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/request_context_spec.rb | 2 |
7 files changed, 16 insertions, 16 deletions
diff --git a/spec/lib/gitlab/daemon_spec.rb b/spec/lib/gitlab/daemon_spec.rb index c519984a267..2bdb0dfc736 100644 --- a/spec/lib/gitlab/daemon_spec.rb +++ b/spec/lib/gitlab/daemon_spec.rb @@ -13,7 +13,7 @@ describe Gitlab::Daemon do allow(Kernel).to receive(:at_exit) end - after(:each) do + after do described_class.instance_variable_set(:@instance, nil) end diff --git a/spec/lib/gitlab/data_builder/note_spec.rb b/spec/lib/gitlab/data_builder/note_spec.rb index 6415e4083d6..aaa42566a4d 100644 --- a/spec/lib/gitlab/data_builder/note_spec.rb +++ b/spec/lib/gitlab/data_builder/note_spec.rb @@ -6,7 +6,7 @@ describe Gitlab::DataBuilder::Note do let(:data) { described_class.build(note, user) } let(:fixed_time) { Time.at(1425600000) } # Avoid time precision errors - before(:each) do + before do expect(data).to have_key(:object_attributes) expect(data[:object_attributes]).to have_key(:url) expect(data[:object_attributes][:url]) diff --git a/spec/lib/gitlab/git/diff_collection_spec.rb b/spec/lib/gitlab/git/diff_collection_spec.rb index 0cfb210e390..3494f0cc98d 100644 --- a/spec/lib/gitlab/git/diff_collection_spec.rb +++ b/spec/lib/gitlab/git/diff_collection_spec.rb @@ -384,7 +384,7 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do context 'when go over safe limits on files' do let(:iterator) { [fake_diff(1, 1)] * 4 } - before(:each) do + before do stub_const('Gitlab::Git::DiffCollection::DEFAULT_LIMITS', { max_files: 2, max_lines: max_lines }) end @@ -409,7 +409,7 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do ] end - before(:each) do + before do stub_const('Gitlab::Git::DiffCollection::DEFAULT_LIMITS', { max_files: max_files, max_lines: 80 }) end @@ -434,7 +434,7 @@ describe Gitlab::Git::DiffCollection, seed_helper: true do ] end - before(:each) do + before do stub_const('Gitlab::Git::DiffCollection::DEFAULT_LIMITS', { max_files: max_files, max_lines: 80 }) end diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index a90c848432e..04c86a2c1a7 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1023,7 +1023,7 @@ describe Gitlab::Git::Repository, seed_helper: true do end context "with no .gitattrbutes" do - before(:each) do + before do repository.copy_gitattributes("master") end @@ -1031,13 +1031,13 @@ describe Gitlab::Git::Repository, seed_helper: true do expect(File.exist?(attributes_path)).to be_falsey end - after(:each) do + after do FileUtils.rm_rf(attributes_path) end end context "with .gitattrbutes" do - before(:each) do + before do repository.copy_gitattributes("gitattributes") end @@ -1050,13 +1050,13 @@ describe Gitlab::Git::Repository, seed_helper: true do expect(contents).to eq("*.md binary\n") end - after(:each) do + after do FileUtils.rm_rf(attributes_path) end end context "with updated .gitattrbutes" do - before(:each) do + before do repository.copy_gitattributes("gitattributes") repository.copy_gitattributes("gitattributes-updated") end @@ -1070,13 +1070,13 @@ describe Gitlab::Git::Repository, seed_helper: true do expect(contents).to eq("*.txt binary\n") end - after(:each) do + after do FileUtils.rm_rf(attributes_path) end end context "with no .gitattrbutes in HEAD but with previous info/attributes" do - before(:each) do + before do repository.copy_gitattributes("gitattributes") repository.copy_gitattributes("master") end @@ -1085,7 +1085,7 @@ describe Gitlab::Git::Repository, seed_helper: true do expect(File.exist?(attributes_path)).to be_falsey end - after(:each) do + after do FileUtils.rm_rf(attributes_path) end end diff --git a/spec/lib/gitlab/git/storage/circuit_breaker_spec.rb b/spec/lib/gitlab/git/storage/circuit_breaker_spec.rb index b2886628601..7256402b010 100644 --- a/spec/lib/gitlab/git/storage/circuit_breaker_spec.rb +++ b/spec/lib/gitlab/git/storage/circuit_breaker_spec.rb @@ -174,7 +174,7 @@ describe Gitlab::Git::Storage::CircuitBreaker, clean_gitlab_redis_shared_state: end describe '#track_storage_inaccessible' do - around(:each) do |example| + around do |example| Timecop.freeze example.run diff --git a/spec/lib/gitlab/health_checks/fs_shards_check_spec.rb b/spec/lib/gitlab/health_checks/fs_shards_check_spec.rb index 26574df8bb5..a0e5e401359 100644 --- a/spec/lib/gitlab/health_checks/fs_shards_check_spec.rb +++ b/spec/lib/gitlab/health_checks/fs_shards_check_spec.rb @@ -107,7 +107,7 @@ describe Gitlab::HealthChecks::FsShardsCheck do end # Unsolved intermittent failure in CI https://gitlab.com/gitlab-org/gitlab-ce/issues/31128 - around(:each) do |example| # rubocop:disable RSpec/AroundBlock + around do |example| # rubocop:disable RSpec/AroundBlock times_to_try = ENV['CI'] ? 4 : 1 example.run_with_retry retry: times_to_try end diff --git a/spec/lib/gitlab/request_context_spec.rb b/spec/lib/gitlab/request_context_spec.rb index e272bdb9284..8a28ad0e597 100644 --- a/spec/lib/gitlab/request_context_spec.rb +++ b/spec/lib/gitlab/request_context_spec.rb @@ -7,7 +7,7 @@ describe Gitlab::RequestContext do let(:env) { Hash.new } context 'when RequestStore::Middleware is used' do - around(:each) do |example| + around do |example| RequestStore::Middleware.new(-> (env) { example.run }).call({}) end |