summaryrefslogtreecommitdiff
path: root/spec/models/prometheus_metric_spec.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2019-02-20 19:51:26 +0100
committerRémy Coutable <remy@rymai.me>2019-02-20 19:51:26 +0100
commitb85b6590e50ac8ae6fa2fda64a58dc83f6ca615f (patch)
tree6784f025b4aaf63c15ac377d9c89c83cb18058e9 /spec/models/prometheus_metric_spec.rb
parente0fc809b2697d06cb89e9d6acbb9339e36ef59e7 (diff)
downloadgitlab-ce-b85b6590e50ac8ae6fa2fda64a58dc83f6ca615f.tar.gz
Fix and document an RSpec::Parameterized::TableSyntax edge-case
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/models/prometheus_metric_spec.rb')
-rw-r--r--spec/models/prometheus_metric_spec.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/spec/models/prometheus_metric_spec.rb b/spec/models/prometheus_metric_spec.rb
index 2b978c1c8ff..3610408c138 100644
--- a/spec/models/prometheus_metric_spec.rb
+++ b/spec/models/prometheus_metric_spec.rb
@@ -4,7 +4,6 @@ require 'spec_helper'
describe PrometheusMetric do
subject { build(:prometheus_metric) }
- let(:other_project) { build(:project) }
it_behaves_like 'having unique enum values'
@@ -16,17 +15,17 @@ describe PrometheusMetric do
describe 'common metrics' do
using RSpec::Parameterized::TableSyntax
- where(:common, :project, :result) do
- false | other_project | true
- false | nil | false
- true | other_project | false
- true | nil | true
+ where(:common, :with_project, :result) do
+ false | true | true
+ false | false | false
+ true | true | false
+ true | false | true
end
with_them do
before do
subject.common = common
- subject.project = project
+ subject.project = with_project ? build(:project) : nil
end
it { expect(subject.valid?).to eq(result) }