diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-11-30 12:27:49 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-12-12 11:44:21 +0300 |
commit | 5ac98f9315296566576b2b6af0ce2f0629f52cfd (patch) | |
tree | 2ee1ca78e32827768851486d19e4f71e2ba65262 /spec/migrations/migrate_gcp_clusters_to_new_clusters_architectures_spec.rb | |
parent | ba731b2ab2426745486f87bde006fa59c4bfcdd8 (diff) |
Create models directly in migration specs
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/migrate_gcp_clusters_to_new_clusters_architectures_spec.rb')
-rw-r--r-- | spec/migrations/migrate_gcp_clusters_to_new_clusters_architectures_spec.rb | 11 |
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) |