Commit 4b663bbe authored by alinamihaila's avatar alinamihaila

Use git add . for checking skip_validation

parent ac440507
...@@ -82,9 +82,7 @@ module Gitlab ...@@ -82,9 +82,7 @@ module Gitlab
end end
def skip_validation? def skip_validation?
return false if attributes[:skip_validation].blank? !!attributes[:skip_validation]
attributes[:skip_validation]
end end
end end
end end
......
...@@ -66,6 +66,13 @@ RSpec.describe Gitlab::Usage::MetricDefinition do ...@@ -66,6 +66,13 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
described_class.new(path, attributes).validate! described_class.new(path, attributes).validate!
end end
context 'with skip_validation' do
it 'raise exception if skip_validation: false' do
expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception).at_least(:once).with(instance_of(Gitlab::Usage::Metric::InvalidMetricError))
described_class.new(path, attributes.merge( { skip_validation: false } )).validate!
end
it 'does not raise exception if has skip_validation: true' do it 'does not raise exception if has skip_validation: true' do
expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception) expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception)
...@@ -73,6 +80,7 @@ RSpec.describe Gitlab::Usage::MetricDefinition do ...@@ -73,6 +80,7 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
end end
end end
end end
end
describe '.load_all!' do describe '.load_all!' do
let(:metric1) { Dir.mktmpdir('metric1') } let(:metric1) { Dir.mktmpdir('metric1') }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment