diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-27 03:06:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-27 03:06:23 +0300 |
commit | 41aba3c68d1ab3b450f1b33027c57258ff88f28e (patch) | |
tree | e1ee61d4a069ad4f7ded56565de5775bc8f0fc30 /spec | |
parent | 430999251558db3c64b4adfc6e2b4fb771f6cd48 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/import_export/shared_spec.rb | 11 | ||||
-rw-r--r-- | spec/support/helpers/migrations_helpers.rb | 35 |
2 files changed, 41 insertions, 5 deletions
diff --git a/spec/lib/gitlab/import_export/shared_spec.rb b/spec/lib/gitlab/import_export/shared_spec.rb index da2c96dcf51..62669836973 100644 --- a/spec/lib/gitlab/import_export/shared_spec.rb +++ b/spec/lib/gitlab/import_export/shared_spec.rb @@ -53,16 +53,17 @@ describe Gitlab::ImportExport::Shared do subject.error(error) end - it 'calls the error logger with the full message' do - expect(subject).to receive(:log_error).with(hash_including(message: error.message)) + it 'calls the error logger without a backtrace' do + expect(subject).to receive(:log_error).with(message: error.message) subject.error(error) end - it 'calls the debug logger with a backtrace' do - error.set_backtrace('backtrace') + it 'calls the error logger with the full message' do + backtrace = caller + allow(error).to receive(:backtrace).and_return(caller) - expect(subject).to receive(:log_debug).with(hash_including(backtrace: 'backtrace')) + expect(subject).to receive(:log_error).with(message: error.message, error_backtrace: Gitlab::Profiler.clean_backtrace(backtrace)) subject.error(error) end diff --git a/spec/support/helpers/migrations_helpers.rb b/spec/support/helpers/migrations_helpers.rb index 176788d0506..68f71494771 100644 --- a/spec/support/helpers/migrations_helpers.rb +++ b/spec/support/helpers/migrations_helpers.rb @@ -132,6 +132,41 @@ module MigrationsHelpers migration.name == described_class.name end end + + class ReversibleMigrationTest + attr_reader :before_up, :after_up + + def initialize + @before_up = -> {} + @after_up = -> {} + end + + def before(expectations) + @before_up = expectations + + self + end + + def after(expectations) + @after_up = expectations + + self + end + end + + def reversible_migration(&block) + tests = yield(ReversibleMigrationTest.new) + + tests.before_up.call + + migrate! + + tests.after_up.call + + schema_migrate_down! + + tests.before_up.call + end end MigrationsHelpers.prepend_if_ee('EE::MigrationsHelpers') |