debian-mirror-gitlab/spec/migrations/backfill_operations_feature_flags_iid_spec.rb

33 lines
825 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
require 'spec_helper'
2021-09-04 01:27:46 +05:30
require_migration!
2020-03-13 15:44:24 +05:30
2020-07-28 23:09:34 +05:30
RSpec.describe BackfillOperationsFeatureFlagsIid do
2020-03-13 15:44:24 +05:30
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:flags) { table(:operations_feature_flags) }
def setup
namespace = namespaces.create!(name: 'foo', path: 'foo')
2021-04-29 21:17:54 +05:30
projects.create!(namespace_id: namespace.id)
2020-03-13 15:44:24 +05:30
end
it 'migrates successfully when there are no flags in the database' do
setup
disable_migrations_output { migrate! }
expect(flags.count).to eq(0)
end
it 'migrates successfully with a row in the table in both FOSS and EE' do
project = setup
flags.create!(project_id: project.id, active: true, name: 'test_flag')
disable_migrations_output { migrate! }
expect(flags.count).to eq(1)
end
end