diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/lib/gitlab/usage/docs | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/lib/gitlab/usage/docs')
-rw-r--r-- | spec/lib/gitlab/usage/docs/helper_spec.rb | 79 | ||||
-rw-r--r-- | spec/lib/gitlab/usage/docs/renderer_spec.rb | 24 | ||||
-rw-r--r-- | spec/lib/gitlab/usage/docs/value_formatter_spec.rb | 26 |
3 files changed, 0 insertions, 129 deletions
diff --git a/spec/lib/gitlab/usage/docs/helper_spec.rb b/spec/lib/gitlab/usage/docs/helper_spec.rb deleted file mode 100644 index e2bb1d8d818..00000000000 --- a/spec/lib/gitlab/usage/docs/helper_spec.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::Usage::Docs::Helper do - subject(:helper) { klass.new } - - let_it_be(:klass) do - Class.new do - include Gitlab::Usage::Docs::Helper - end - end - - let(:metric_definition) do - { - data_category: 'Standard', - name: 'test_metric', - description: description, - product_group: 'group::product intelligence', - status: 'data_available', - tier: %w(free premium) - } - end - - let(:description) { 'Metric description' } - - describe '#render_name' do - it { expect(helper.render_name(metric_definition[:name])).to eq('### `test_metric`') } - end - - describe '#render_description' do - context 'without description' do - let(:description) { nil } - - it { expect(helper.render_description(metric_definition)).to eq('Missing description') } - end - - context 'without description' do - it { expect(helper.render_description(metric_definition)).to eq('Metric description') } - end - end - - describe '#render_yaml_link' do - let(:yaml_link) { 'config/metrics/license/test_metric.yml' } - let(:expected) { "[YAML definition](#{yaml_link})" } - - it { expect(helper.render_yaml_link(yaml_link)).to eq(expected) } - end - - describe '#render_status' do - let(:expected) { "Status: `data_available`" } - - it { expect(helper.render_status(metric_definition)).to eq(expected) } - end - - describe '#render_owner' do - let(:expected) { "Group: `group::product intelligence`" } - - it { expect(helper.render_owner(metric_definition)).to eq(expected) } - end - - describe '#render_tiers' do - let(:expected) { "Tiers: `free`, `premium`" } - - it { expect(helper.render_tiers(metric_definition)).to eq(expected) } - end - - describe '#render_data_category' do - let(:expected) { 'Data Category: `Standard`' } - - it { expect(helper.render_data_category(metric_definition)).to eq(expected) } - end - - describe '#render_owner' do - let(:expected) { "Group: `group::product intelligence`" } - - it { expect(helper.render_owner(metric_definition)).to eq(expected) } - end -end diff --git a/spec/lib/gitlab/usage/docs/renderer_spec.rb b/spec/lib/gitlab/usage/docs/renderer_spec.rb deleted file mode 100644 index f3b83a4a4b3..00000000000 --- a/spec/lib/gitlab/usage/docs/renderer_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -CODE_REGEX = %r{<code>(.*)</code>}.freeze - -RSpec.describe Gitlab::Usage::Docs::Renderer do - describe 'contents' do - let(:dictionary_path) { Gitlab::Usage::Docs::Renderer::DICTIONARY_PATH } - let(:items) { Gitlab::Usage::MetricDefinition.definitions.first(10).to_h } - - it 'generates dictionary for given items' do - generated_dictionary = described_class.new(items).contents - - generated_dictionary_keys = RDoc::Markdown - .parse(generated_dictionary) - .table_of_contents - .select { |metric_doc| metric_doc.level == 3 } - .map { |item| item.text.match(CODE_REGEX)&.captures&.first } - - expect(generated_dictionary_keys).to match_array(items.keys) - end - end -end diff --git a/spec/lib/gitlab/usage/docs/value_formatter_spec.rb b/spec/lib/gitlab/usage/docs/value_formatter_spec.rb deleted file mode 100644 index f21656df894..00000000000 --- a/spec/lib/gitlab/usage/docs/value_formatter_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::Usage::Docs::ValueFormatter do - describe '.format' do - using RSpec::Parameterized::TableSyntax - where(:key, :value, :expected_value) do - :product_group | 'growth::product intelligence' | '`growth::product intelligence`' - :data_source | 'redis' | 'Redis' - :data_source | 'ruby' | 'Ruby' - :introduced_by_url | 'http://test.com' | '[Introduced by](http://test.com)' - :tier | %w(gold premium) | ' `gold`, `premium`' - :distribution | %w(ce ee) | ' `ce`, `ee`' - :key_path | 'key.path' | '**`key.path`**' - :milestone | '13.4' | '13.4' - :status | 'data_available' | '`data_available`' - end - - with_them do - subject { described_class.format(key, value) } - - it { is_expected.to eq(expected_value) } - end - end -end |