Commit 9c177d23 authored by Robert Speicher's avatar Robert Speicher

Remove the Plan seed entirely and add factories to create them on-demand

parent bbcaf4ae
require './spec/support/sidekiq'
Plan.seed(name: EE::Namespace::FREE_PLAN,
title: EE::Namespace::FREE_PLAN.titleize)
EE::Namespace::NAMESPACE_PLANS_TO_LICENSE_PLANS.each_key do |plan|
Plan.seed(name: plan, title: plan.titleize)
end
require 'spec_helper'
describe EE::Gitlab::Ci::Pipeline::Chain::Limit::Activity do
set(:namespace) { create(:namespace, plan: Namespace::GOLD_PLAN) }
set(:namespace) { create(:namespace, plan: :gold_plan) }
set(:project) { create(:project, namespace: namespace) }
set(:user) { create(:user) }
......
require 'spec_helper'
describe EE::Gitlab::Ci::Pipeline::Chain::Limit::Size do
set(:namespace) { create(:namespace, plan: Namespace::GOLD_PLAN) }
set(:namespace) { create(:namespace, plan: :gold_plan) }
set(:project) { create(:project, namespace: namespace) }
set(:user) { create(:user) }
......
require 'spec_helper'
describe EE::Gitlab::Ci::Pipeline::Quota::Size do
set(:namespace) { create(:namespace, plan: EE::Namespace::GOLD_PLAN) }
set(:namespace) { create(:namespace, plan: :gold_plan) }
set(:project) { create(:project, namespace: namespace) }
let(:pipeline) { build_stubbed(:ci_pipeline, project: project) }
......
require 'spec_helper'
describe Ci::CreatePipelineService, '#execute' do
set(:namespace) { create(:namespace, plan: EE::Namespace::GOLD_PLAN) }
set(:namespace) { create(:namespace, plan: :gold_plan) }
set(:project) { create(:project, :repository, namespace: namespace) }
set(:user) { create(:user) }
......
......@@ -21,5 +21,16 @@ FactoryGirl.define do
namespace_statistics factory: :namespace_statistics, shared_runners_seconds: 1000.minutes.to_i
shared_runners_minutes_limit 500
end
# EE-only
transient do
plan nil
end
before :create do |namespace, evaluator|
if evaluator.plan
namespace.plan = create(evaluator.plan)
end
end
end
end
# EE-only
FactoryGirl.define do
factory :plan do
factory :free_plan do
name EE::Namespace::FREE_PLAN
title { name.titleize }
end
EE::Namespace::PLANS.each do |plan|
factory :"#{plan}_plan" do
name plan
title { name.titleize }
end
end
end
end
......@@ -107,8 +107,6 @@ RSpec.configure do |config|
config.before(:all) do
License.destroy_all
TestLicense.init
SeedFu.seed
end
config.after(:suite) do
......
......@@ -14,11 +14,11 @@ RSpec.configure do |config|
end
config.before(:each, :js) do
DatabaseCleaner.strategy = :truncation, { except: %w[licenses plans] }
DatabaseCleaner.strategy = :truncation, { except: %w[licenses] }
end
config.before(:each, :truncate) do
DatabaseCleaner.strategy = :truncation, { except: %w[licenses plans] }
DatabaseCleaner.strategy = :truncation, { except: %w[licenses] }
end
config.before(:each, :migration) do
......
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