diff options
Diffstat (limited to 'spec/helpers/external_link_helper_spec.rb')
-rw-r--r-- | spec/helpers/external_link_helper_spec.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/spec/helpers/external_link_helper_spec.rb b/spec/helpers/external_link_helper_spec.rb index b1a1884d887..f5bb0568824 100644 --- a/spec/helpers/external_link_helper_spec.rb +++ b/spec/helpers/external_link_helper_spec.rb @@ -6,12 +6,15 @@ RSpec.describe ExternalLinkHelper do include IconsHelper it 'returns external link with icon' do - expect(external_link('https://gitlab.com', 'https://gitlab.com').to_s) - .to eq('<a target="_blank" rel="noopener noreferrer" href="https://gitlab.com">https://gitlab.com <i aria-hidden="true" data-hidden="true" class="fa fa-external-link"></i></a>') + link = external_link('https://gitlab.com', 'https://gitlab.com').to_s + expect(link).to start_with('<a target="_blank" rel="noopener noreferrer" href="https://gitlab.com">https://gitlab.com') + expect(link).to include('data-testid="external-link-icon"') end it 'allows options when creating external link with icon' do - expect(external_link('https://gitlab.com', 'https://gitlab.com', { "data-foo": "bar", class: "externalLink" }).to_s) - .to eq('<a target="_blank" rel="noopener noreferrer" data-foo="bar" class="externalLink" href="https://gitlab.com">https://gitlab.com <i aria-hidden="true" data-hidden="true" class="fa fa-external-link"></i></a>') + link = external_link('https://gitlab.com', 'https://gitlab.com', { "data-foo": "bar", class: "externalLink" }).to_s + + expect(link).to start_with('<a target="_blank" rel="noopener noreferrer" data-foo="bar" class="externalLink" href="https://gitlab.com">https://gitlab.com') + expect(link).to include('data-testid="external-link-icon"') end end |