diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/migrations/confirm_security_bot_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/migrations/confirm_security_bot_spec.rb')
-rw-r--r-- | spec/migrations/confirm_security_bot_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/migrations/confirm_security_bot_spec.rb b/spec/migrations/confirm_security_bot_spec.rb new file mode 100644 index 00000000000..19ca81f92f3 --- /dev/null +++ b/spec/migrations/confirm_security_bot_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe ConfirmSecurityBot, :migration do + let(:users) { table(:users) } + + let(:user_type) { 8 } + + context 'when bot is not created' do + it 'skips migration' do + migrate! + + bot = users.find_by(user_type: user_type) + + expect(bot).to be_nil + end + end + + context 'when bot is confirmed' do + let(:bot) { table(:users).create!(user_type: user_type, confirmed_at: Time.current, projects_limit: 1) } + + it 'skips migration' do + expect { migrate! }.not_to change { bot.reload.confirmed_at } + end + end + + context 'when bot is not confirmed' do + let(:bot) { table(:users).create!(user_type: user_type, projects_limit: 1) } + + it 'update confirmed_at' do + freeze_time do + expect { migrate! }.to change { bot.reload.confirmed_at }.from(nil).to(Time.current) + end + end + end +end |