blob: 57c51c9d9c2caf280780463055f370b240b34950 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Database::MigrationHelpers::AnnounceDatabase do
let(:migration) do
ActiveRecord::Migration.new('MyMigration', 1111).extend(described_class)
end
describe '#announce' do
it 'prefixes message with database name' do
expect { migration.announce('migrating') }.to output(/^main: == 1111 MyMigration: migrating/).to_stdout
end
end
describe '#say' do
it 'prefixes message with database name' do
expect { migration.say('transaction_open?()') }.to output(/^main: -- transaction_open?()/).to_stdout
end
it 'prefixes subitem message with database name' do
expect { migration.say('0.0000s', true) }.to output(/^main: -> 0.0000s/).to_stdout
end
end
describe '#write' do
it 'does not prefix empty write' do
expect { migration.write }.to output(/^$/).to_stdout
end
end
end
|