Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 11:27:35 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 11:27:35 +0300
commit7e9c479f7de77702622631cff2628a9c8dcbc627 (patch)
treec8f718a08e110ad7e1894510980d2155a6549197 /spec/helpers/stat_anchors_helper_spec.rb
parente852b0ae16db4052c1c567d9efa4facc81146e88 (diff)
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/helpers/stat_anchors_helper_spec.rb')
-rw-r--r--spec/helpers/stat_anchors_helper_spec.rb53
1 files changed, 53 insertions, 0 deletions
diff --git a/spec/helpers/stat_anchors_helper_spec.rb b/spec/helpers/stat_anchors_helper_spec.rb
new file mode 100644
index 00000000000..c6556647bc8
--- /dev/null
+++ b/spec/helpers/stat_anchors_helper_spec.rb
@@ -0,0 +1,53 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe StatAnchorsHelper do
+ let(:anchor_klass) { ProjectPresenter::AnchorData }
+
+ describe '#stat_anchor_attrs' do
+ subject { helper.stat_anchor_attrs(anchor) }
+
+ context 'when anchor is a link' do
+ let(:anchor) { anchor_klass.new(true) }
+
+ it 'returns the proper attributes' do
+ expect(subject[:class]).to include('stat-link')
+ end
+ end
+
+ context 'when anchor is not a link' do
+ context 'when class_modifier is set' do
+ let(:anchor) { anchor_klass.new(false, nil, nil, 'default') }
+
+ it 'returns the proper attributes' do
+ expect(subject[:class]).to include('btn btn-default')
+ end
+ end
+
+ context 'when class_modifier is not set' do
+ let(:anchor) { anchor_klass.new(false) }
+
+ it 'returns the proper attributes' do
+ expect(subject[:class]).to include('btn btn-missing')
+ end
+ end
+ end
+
+ context 'when itemprop is not set' do
+ let(:anchor) { anchor_klass.new(false, nil, nil, nil, nil, false) }
+
+ it 'returns the itemprop attributes' do
+ expect(subject[:itemprop]).to be_nil
+ end
+ end
+
+ context 'when itemprop is set set' do
+ let(:anchor) { anchor_klass.new(false, nil, nil, nil, nil, true) }
+
+ it 'returns the itemprop attributes' do
+ expect(subject[:itemprop]).to eq true
+ end
+ end
+ end
+end