diff options
author | Nick Thomas <nick@gitlab.com> | 2019-03-13 13:42:43 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-03-13 13:42:43 +0000 |
commit | 9f05e97aad33a0cd70862f67101bdcb3fddc639a (patch) | |
tree | a9868d2c6711ebff1dcbb06f6d09f91d15caa631 /spec | |
parent | 5ed9c5f7f74d7305bb884a6ae7a601d4563398a4 (diff) | |
download | gitlab-ce-9f05e97aad33a0cd70862f67101bdcb3fddc639a.tar.gz |
Run rubocop -a
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/git/repository_cleaner_spec.rb | 12 | ||||
-rw-r--r-- | spec/rack_servers/puma_spec.rb | 8 | ||||
-rw-r--r-- | spec/services/projects/destroy_service_spec.rb | 6 | ||||
-rw-r--r-- | spec/support/helpers/graphql_helpers.rb | 10 | ||||
-rw-r--r-- | spec/support/helpers/stub_object_storage.rb | 12 | ||||
-rw-r--r-- | spec/support/helpers/test_env.rb | 10 |
7 files changed, 25 insertions, 39 deletions
diff --git a/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb b/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb index bc71a90605a..e7ff9169f1b 100644 --- a/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb +++ b/spec/lib/gitlab/background_migration/deserialize_merge_request_diffs_and_commits_spec.rb @@ -172,10 +172,8 @@ describe Gitlab::BackgroundMigration::DeserializeMergeRequestDiffsAndCommits, :m let(:exception) { ActiveRecord::RecordNotFound } let(:perform_ignoring_exceptions) do - begin - subject.perform(start_id, stop_id) - rescue described_class::Error - end + subject.perform(start_id, stop_id) + rescue described_class::Error end before do diff --git a/spec/lib/gitlab/git/repository_cleaner_spec.rb b/spec/lib/gitlab/git/repository_cleaner_spec.rb index 7f9cc2bc9ec..6602f22843f 100644 --- a/spec/lib/gitlab/git/repository_cleaner_spec.rb +++ b/spec/lib/gitlab/git/repository_cleaner_spec.rb @@ -37,14 +37,12 @@ describe Gitlab::Git::RepositoryCleaner do let(:object_map) { Gitlab::HttpIO.new(url, object_map_data.size) } around do |example| - begin - tempfile.write(object_map_data) - tempfile.close + tempfile.write(object_map_data) + tempfile.close - example.run - ensure - tempfile.unlink - end + example.run + ensure + tempfile.unlink end it 'removes internal references' do diff --git a/spec/rack_servers/puma_spec.rb b/spec/rack_servers/puma_spec.rb index 431fab87857..891df4f1a66 100644 --- a/spec/rack_servers/puma_spec.rb +++ b/spec/rack_servers/puma_spec.rb @@ -44,11 +44,9 @@ describe 'Puma' do end after(:all) do - begin - WebMock.disable_net_connect!(allow_localhost: true) - Process.kill('TERM', @puma_master_pid) - rescue Errno::ESRCH - end + WebMock.disable_net_connect!(allow_localhost: true) + Process.kill('TERM', @puma_master_pid) + rescue Errno::ESRCH end def wait_puma_boot!(master_pid, ready_file) diff --git a/spec/services/projects/destroy_service_spec.rb b/spec/services/projects/destroy_service_spec.rb index dfbdfa2ab69..d3a8ee46f85 100644 --- a/spec/services/projects/destroy_service_spec.rb +++ b/spec/services/projects/destroy_service_spec.rb @@ -128,10 +128,8 @@ describe Projects::DestroyService do it 'keeps project team intact upon an error' do perform_enqueued_jobs do - begin - destroy_project(project, user, {}) - rescue ::Redis::CannotConnectError - end + destroy_project(project, user, {}) + rescue ::Redis::CannotConnectError end expect(project.team.members.count).to eq 2 diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb index 6cdc19ac2e5..ca28325eab9 100644 --- a/spec/support/helpers/graphql_helpers.rb +++ b/spec/support/helpers/graphql_helpers.rb @@ -18,12 +18,10 @@ module GraphqlHelpers # Runs a block inside a BatchLoader::Executor wrapper def batch(max_queries: nil, &blk) wrapper = proc do - begin - BatchLoader::Executor.ensure_current - yield - ensure - BatchLoader::Executor.clear_current - end + BatchLoader::Executor.ensure_current + yield + ensure + BatchLoader::Executor.clear_current end if max_queries diff --git a/spec/support/helpers/stub_object_storage.rb b/spec/support/helpers/stub_object_storage.rb index e0c50e533a6..30c8477f16a 100644 --- a/spec/support/helpers/stub_object_storage.rb +++ b/spec/support/helpers/stub_object_storage.rb @@ -23,15 +23,13 @@ module StubObjectStorage Fog.mock! ::Fog::Storage.new(connection_params).tap do |connection| - begin - connection.directories.create(key: remote_directory) + connection.directories.create(key: remote_directory) - # Cleanup remaining files - connection.directories.each do |directory| - directory.files.map(&:destroy) - end - rescue Excon::Error::Conflict + # Cleanup remaining files + connection.directories.each do |directory| + directory.files.map(&:destroy) end + rescue Excon::Error::Conflict end end diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb index 80a22134021..dc902d373b8 100644 --- a/spec/support/helpers/test_env.rb +++ b/spec/support/helpers/test_env.rb @@ -202,12 +202,10 @@ module TestEnv socket = Gitlab::GitalyClient.address('default').sub('unix:', '') Integer(sleep_time / sleep_interval).times do - begin - Socket.unix(socket) - return - rescue - sleep sleep_interval - end + Socket.unix(socket) + return + rescue + sleep sleep_interval end raise "could not connect to gitaly at #{socket.inspect} after #{sleep_time} seconds" |