summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-05-19 04:01:16 -0700
committerStan Hu <stanhu@gmail.com>2019-05-19 04:01:16 -0700
commitc2405e238484a405f3811ec93381629f5769d8ad (patch)
treee9601ccbd21571f36f69e1d94c809523323cf79b
parent2728bfb53cb1c4e29d7935d50bf56da49ebd2af5 (diff)
downloadgitlab-ce-sh-bump-shoulda-matcher.tar.gz
Ensure subject passes validationssh-bump-shoulda-matcher
Rails 5 requires that belongs_to associations have the associated record present. These tests were failing because they had nil values.
-rw-r--r--spec/models/ci/pipeline_schedule_spec.rb2
-rw-r--r--spec/models/clusters/cluster_spec.rb2
2 files changed, 4 insertions, 0 deletions
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) }