diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-11 09:06:38 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-11 09:06:38 +0000 |
commit | 4a45f0eff2a25c64bdd83926e35a8894a4f0469f (patch) | |
tree | 8068fff1731ccf4182605c2661c25f0a1c936866 /spec/migrations | |
parent | d9c3a63a4394990bcdccbaca73c58278469236b4 (diff) | |
download | gitlab-ce-4a45f0eff2a25c64bdd83926e35a8894a4f0469f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/migrations')
-rw-r--r-- | spec/migrations/add_default_and_free_plans_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/migrations/add_default_and_free_plans_spec.rb b/spec/migrations/add_default_and_free_plans_spec.rb new file mode 100644 index 00000000000..ae40b5b10c2 --- /dev/null +++ b/spec/migrations/add_default_and_free_plans_spec.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require 'spec_helper' +require Rails.root.join('db', 'migrate', '20191023152913_add_default_and_free_plans.rb') + +describe AddDefaultAndFreePlans, :migration do + describe 'migrate' do + let(:plans) { table(:plans) } + + context 'when on Gitlab.com' do + before do + expect(Gitlab).to receive(:com?) { true } + end + + it 'creates free and default plans' do + expect { migrate! }.to change { plans.count }.by 2 + + expect(plans.last(2).pluck(:name)).to eq %w[free default] + end + end + + context 'when on self-hosted' do + before do + expect(Gitlab).to receive(:com?) { false } + end + + it 'creates only a default plan' do + expect { migrate! }.to change { plans.count }.by 1 + + expect(plans.last.name).to eq 'default' + end + end + end +end |