summaryrefslogtreecommitdiff
path: root/spec/migrations
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-11-30 10:27:49 +0100
committerBob Van Landuyt <bob@vanlanduyt.co>2017-12-12 09:44:21 +0100
commit5ac98f9315296566576b2b6af0ce2f0629f52cfd (patch)
tree2ee1ca78e32827768851486d19e4f71e2ba65262 /spec/migrations
parentba731b2ab2426745486f87bde006fa59c4bfcdd8 (diff)
downloadgitlab-ce-5ac98f9315296566576b2b6af0ce2f0629f52cfd.tar.gz
Create models directly in migration specsbvl-backport-migration-spec-changes-to-ce
Instead of using the factories. Since the factories might be using columns that aren't available in the schema at version the particular spec is running in.
Diffstat (limited to 'spec/migrations')
-rw-r--r--spec/migrations/migrate_gcp_clusters_to_new_clusters_architectures_spec.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/migrations/migrate_gcp_clusters_to_new_clusters_architectures_spec.rb b/spec/migrations/migrate_gcp_clusters_to_new_clusters_architectures_spec.rb
index 05f281fffff..57ee2adaaff 100644
--- a/spec/migrations/migrate_gcp_clusters_to_new_clusters_architectures_spec.rb
+++ b/spec/migrations/migrate_gcp_clusters_to_new_clusters_architectures_spec.rb
@@ -2,9 +2,10 @@ require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20171013104327_migrate_gcp_clusters_to_new_clusters_architectures.rb')
describe MigrateGcpClustersToNewClustersArchitectures, :migration do
- let(:project) { create(:project) }
+ let(:projects) { table(:projects) }
+ let(:project) { projects.create }
let(:user) { create(:user) }
- let(:service) { create(:kubernetes_service, project: project) }
+ let(:service) { create(:kubernetes_service, project_id: project.id) }
context 'when cluster is being created' do
let(:project_id) { project.id }
@@ -56,8 +57,7 @@ describe MigrateGcpClustersToNewClustersArchitectures, :migration do
expect(cluster.provider_type).to eq('gcp')
expect(cluster.platform_type).to eq('kubernetes')
- expect(cluster.project).to eq(project)
- expect(project.clusters).to include(cluster)
+ expect(cluster.project_ids).to include(project.id)
expect(cluster.provider_gcp.cluster).to eq(cluster)
expect(cluster.provider_gcp.status).to eq(status)
@@ -133,8 +133,7 @@ describe MigrateGcpClustersToNewClustersArchitectures, :migration do
expect(cluster.provider_type).to eq('gcp')
expect(cluster.platform_type).to eq('kubernetes')
- expect(cluster.project).to eq(project)
- expect(project.clusters).to include(cluster)
+ expect(cluster.project_ids).to include(project.id)
expect(cluster.provider_gcp.cluster).to eq(cluster)
expect(cluster.provider_gcp.status).to eq(status)