Commit 0d88bc8e authored by Sean McGivern's avatar Sean McGivern

Merge branch 'mk-future-proof-migration-spec' into 'master'

Future proof migration spec from irrelevant failures

Closes #3102

See merge request !2635
parents b22d0230 db96561e
...@@ -11,13 +11,13 @@ describe UpdateAuthorizedKeysFile, :migration do ...@@ -11,13 +11,13 @@ describe UpdateAuthorizedKeysFile, :migration do
ActiveRecord::Base.connection.change_column_null :application_settings, :authorized_keys_enabled, true ActiveRecord::Base.connection.change_column_null :application_settings, :authorized_keys_enabled, true
ActiveRecord::Base.connection.change_column :application_settings, :authorized_keys_enabled, :boolean, default: nil ActiveRecord::Base.connection.change_column :application_settings, :authorized_keys_enabled, :boolean, default: nil
ApplicationSetting.create!(authorized_keys_enabled: nil, mirror_max_delay: 300) described_class::ApplicationSetting.create!(authorized_keys_enabled: nil)
end end
it 'sets authorized_keys_enabled to true' do it 'sets authorized_keys_enabled to true' do
migration.up migration.up
expect(ApplicationSetting.last.authorized_keys_enabled).to be_truthy expect(described_class::ApplicationSetting.last.authorized_keys_enabled).to be_truthy
end end
context 'there are keys created before and after the cutoff datetime' do context 'there are keys created before and after the cutoff datetime' do
...@@ -83,11 +83,11 @@ describe UpdateAuthorizedKeysFile, :migration do ...@@ -83,11 +83,11 @@ describe UpdateAuthorizedKeysFile, :migration do
end end
context 'when is a record in application_settings table' do context 'when is a record in application_settings table' do
context 'when authorized_keys_enabled is true' do
before do before do
ApplicationSetting.create!(authorized_keys_enabled: true, mirror_max_delay: 300) described_class::ApplicationSetting.create!(authorized_keys_enabled: true)
end end
context 'when authorized_keys_enabled is true' do
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
...@@ -97,7 +97,7 @@ describe UpdateAuthorizedKeysFile, :migration do ...@@ -97,7 +97,7 @@ describe UpdateAuthorizedKeysFile, :migration do
ActiveRecord::Base.connection.change_column_null :application_settings, :authorized_keys_enabled, true ActiveRecord::Base.connection.change_column_null :application_settings, :authorized_keys_enabled, true
ActiveRecord::Base.connection.change_column :application_settings, :authorized_keys_enabled, :boolean, default: nil ActiveRecord::Base.connection.change_column :application_settings, :authorized_keys_enabled, :boolean, default: nil
ApplicationSetting.first.update(authorized_keys_enabled: nil, mirror_max_delay: 300) described_class::ApplicationSetting.create!(authorized_keys_enabled: nil)
end end
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
...@@ -105,7 +105,7 @@ describe UpdateAuthorizedKeysFile, :migration do ...@@ -105,7 +105,7 @@ describe UpdateAuthorizedKeysFile, :migration do
context 'when authorized_keys_enabled is explicitly false' do context 'when authorized_keys_enabled is explicitly false' do
before do before do
ApplicationSetting.first.update!(authorized_keys_enabled: false, mirror_max_delay: 300) described_class::ApplicationSetting.create!(authorized_keys_enabled: false)
end end
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
...@@ -118,7 +118,7 @@ describe UpdateAuthorizedKeysFile, :migration do ...@@ -118,7 +118,7 @@ describe UpdateAuthorizedKeysFile, :migration do
context 'when there is no record in application_settings table' do context 'when there is no record in application_settings table' do
before do before do
expect(ApplicationSetting.count).to eq(0) expect(described_class::ApplicationSetting.count).to eq(0)
end end
it { is_expected.to be_falsey } it { is_expected.to be_falsey }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment