From d707e2a49f2efe4670b5ebe62fb61554640ca7e9 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 19 May 2019 04:01:16 -0700 Subject: Ensure subject passes validations Rails 5 requires that belongs_to associations have the associated record present. These tests were failing because they had nil values. --- spec/models/ci/pipeline_schedule_spec.rb | 2 ++ spec/models/clusters/cluster_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/spec/models/ci/pipeline_schedule_spec.rb b/spec/models/ci/pipeline_schedule_spec.rb index 1bfc14d2839..42d4769a921 100644 --- a/spec/models/ci/pipeline_schedule_spec.rb +++ b/spec/models/ci/pipeline_schedule_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' describe Ci::PipelineSchedule do + subject { build(:ci_pipeline_schedule) } + it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:owner) } diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb index 58203da5b22..f9d8ffd06e0 100644 --- a/spec/models/clusters/cluster_spec.rb +++ b/spec/models/clusters/cluster_spec.rb @@ -5,6 +5,8 @@ require 'spec_helper' describe Clusters::Cluster do it_behaves_like 'having unique enum values' + subject { build(:cluster) } + it { is_expected.to belong_to(:user) } it { is_expected.to have_many(:cluster_projects) } it { is_expected.to have_many(:projects) } -- cgit v1.2.1