summaryrefslogtreecommitdiff
path: root/spec/helpers/stat_anchors_helper_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/stat_anchors_helper_spec.rb')
-rw-r--r--spec/helpers/stat_anchors_helper_spec.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/helpers/stat_anchors_helper_spec.rb b/spec/helpers/stat_anchors_helper_spec.rb
index 0615baac3cb..f3830bf4172 100644
--- a/spec/helpers/stat_anchors_helper_spec.rb
+++ b/spec/helpers/stat_anchors_helper_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe StatAnchorsHelper do
context 'when anchor is not a link' do
context 'when class_modifier is set' do
- let(:anchor) { anchor_klass.new(false, nil, nil, 'default') }
+ let(:anchor) { anchor_klass.new(false, nil, nil, 'btn-default') }
it 'returns the proper attributes' do
expect(subject[:class]).to include('gl-button btn btn-default')
@@ -49,5 +49,21 @@ RSpec.describe StatAnchorsHelper do
expect(subject[:itemprop]).to eq true
end
end
+
+ context 'when data is not set' do
+ let(:anchor) { anchor_klass.new(false, nil, nil, nil, nil, nil, nil) }
+
+ it 'returns the data attributes' do
+ expect(subject[:data]).to be_nil
+ end
+ end
+
+ context 'when itemprop is set' do
+ let(:anchor) { anchor_klass.new(false, nil, nil, nil, nil, nil, { 'toggle' => 'modal' }) }
+
+ it 'returns the data attributes' do
+ expect(subject[:data]).to eq({ 'toggle' => 'modal' })
+ end
+ end
end
end