summaryrefslogtreecommitdiff
path: root/spec/migrations
diff options
context:
space:
mode:
authorRubén Dávila <ruben@gitlab.com>2018-06-04 23:00:25 -0500
committerRubén Dávila <ruben@gitlab.com>2018-06-04 23:00:25 -0500
commitc503429e5e8538649bec02d74963ec0eb8f0cb98 (patch)
tree69ee0c0c320b22dae5d46d0392b16b1a89e65aae /spec/migrations
parent160cc6cd7b0218cdd1e210c4133fd469ffacf656 (diff)
downloadgitlab-ce-c503429e5e8538649bec02d74963ec0eb8f0cb98.tar.gz
Add migration to disable the usage of DSA keysrd-44364-deprecate-support-for-dsa-keys
Additionally the current application setting is also updated to disable the usage of DSA keys.
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/change_default_value_for_dsa_key_restriction_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/migrations/change_default_value_for_dsa_key_restriction_spec.rb b/spec/migrations/change_default_value_for_dsa_key_restriction_spec.rb
new file mode 100644
index 00000000000..7e61ab9b52e
--- /dev/null
+++ b/spec/migrations/change_default_value_for_dsa_key_restriction_spec.rb
@@ -0,0 +1,33 @@
+require 'spec_helper'
+require Rails.root.join('db', 'migrate', '20180531220618_change_default_value_for_dsa_key_restriction.rb')
+
+describe ChangeDefaultValueForDsaKeyRestriction, :migration do
+ let(:application_settings) { table(:application_settings) }
+
+ before do
+ application_settings.create!
+ end
+
+ it 'changes the default value for dsa_key_restriction' do
+ expect(application_settings.first.dsa_key_restriction).to eq(0)
+
+ migrate!
+
+ application_settings.reset_column_information
+ new_setting = application_settings.create!
+
+ expect(application_settings.count).to eq(2)
+ expect(new_setting.dsa_key_restriction).to eq(-1)
+ end
+
+ it 'changes the existing setting' do
+ setting = application_settings.last
+
+ expect(setting.dsa_key_restriction).to eq(0)
+
+ migrate!
+
+ expect(application_settings.count).to eq(1)
+ expect(setting.reload.dsa_key_restriction).to eq(-1)
+ end
+end