From 36083b4d0ee6787da6be13b45cc7144de704c308 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 11 May 2016 14:11:04 +0200 Subject: [PATCH] Fixed styling per Rubocop pedantics --- lib/gitlab/database/migration_helpers.rb | 4 +++- spec/lib/gitlab/database/migration_helpers_spec.rb | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 7aa8c90e6d1..4773a88d0c1 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -119,7 +119,9 @@ module Gitlab transaction do update_column_in_batches(table, column, default) end - rescue Exception => error + # We want to rescue _all_ exceptions here, even those that don't inherit + # from StandardError. + rescue Exception => error # rubocop: disable all remove_column(table, column) raise error diff --git a/spec/lib/gitlab/database/migration_helpers_spec.rb b/spec/lib/gitlab/database/migration_helpers_spec.rb index ad2f3cb7e45..ec43165bb53 100644 --- a/spec/lib/gitlab/database/migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migration_helpers_spec.rb @@ -105,9 +105,9 @@ describe Gitlab::Database::MigrationHelpers, lib: true do expect(model).to receive(:remove_column). with(:projects, :foo) - expect { + expect do model.add_column_with_default(:projects, :foo, :integer, default: 10) - }.to raise_error(RuntimeError) + end.to raise_error(RuntimeError) end end @@ -115,9 +115,9 @@ describe Gitlab::Database::MigrationHelpers, lib: true do it 'raises RuntimeError' do expect(model).to receive(:transaction_open?).and_return(true) - expect { + expect do model.add_column_with_default(:projects, :foo, :integer, default: 10) - }.to raise_error(RuntimeError) + end.to raise_error(RuntimeError) end end end