Skip to content

Commit

Permalink
Add spec
Browse files Browse the repository at this point in the history
Test that usernames with underscores get linked correctly

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
  • Loading branch information
Plastikmensch committed Oct 6, 2023
1 parent 41bc94a commit 5930fb7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spec/lib/advanced_text_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@
it 'creates a mention link' do
expect(subject).to include '<a href="https://cb6e6126.ngrok.io/@alice" class="u-url mention">@<span>alice</span></a></span>'
end

context 'when username contains underscores' do
let(:preloaded_accounts) { [Fabricate(:account, username: '_bob_')] }
let(:text) { '@_bob_' }

it 'creates a mention link' do
expect(subject).to include '<a href="https://cb6e6126.ngrok.io/@_bob_" class="u-url mention">@<span>_bob_</span></a></span>'
end
end
end

context 'with text containing unlinkable mentions' do
Expand Down

0 comments on commit 5930fb7

Please sign in to comment.