diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/lib/gitlab/usage/metric_spec.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/lib/gitlab/usage/metric_spec.rb')
-rw-r--r-- | spec/lib/gitlab/usage/metric_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/lib/gitlab/usage/metric_spec.rb b/spec/lib/gitlab/usage/metric_spec.rb new file mode 100644 index 00000000000..40671d980d6 --- /dev/null +++ b/spec/lib/gitlab/usage/metric_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::Usage::Metric do + describe '#definition' do + it 'returns generation_1 metric definiton' do + expect(described_class.new(default_generation_path: 'uuid').definition).to be_an(Gitlab::Usage::MetricDefinition) + end + end + + describe '#unflatten_default_path' do + using RSpec::Parameterized::TableSyntax + + where(:default_generation_path, :value, :expected_hash) do + 'uuid' | nil | { uuid: nil } + 'uuid' | '1111' | { uuid: '1111' } + 'counts.issues' | nil | { counts: { issues: nil } } + 'counts.issues' | 100 | { counts: { issues: 100 } } + 'usage_activity_by_stage.verify.ci_builds' | 100 | { usage_activity_by_stage: { verify: { ci_builds: 100 } } } + end + + with_them do + subject { described_class.new(default_generation_path: default_generation_path, value: value).unflatten_default_path } + + it { is_expected.to eq(expected_hash) } + end + end +end |