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-21 23:19:07 -0700
commitd707e2a49f2efe4670b5ebe62fb61554640ca7e9 (patch)
tree2e4c31abb2b890eb803bdef4d2b5fba022a5c98a
parent52d24e66cec1fa6c0100adb64effd2073869cd8b (diff)
downloadgitlab-ce-d707e2a49f2efe4670b5ebe62fb61554640ca7e9.tar.gz
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.
-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) }