From 4a167ae3caf638ae786b19ccd4e6b62ebbaa38d1 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 30 Nov 2022 11:56:01 +0100 Subject: [PATCH] Add some tests --- spec/lib/advanced_text_formatter_spec.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spec/lib/advanced_text_formatter_spec.rb b/spec/lib/advanced_text_formatter_spec.rb index 3255fc9271..c1e4696061 100644 --- a/spec/lib/advanced_text_formatter_spec.rb +++ b/spec/lib/advanced_text_formatter_spec.rb @@ -35,7 +35,7 @@ RSpec.describe AdvancedTextFormatter do end context 'given a block code' do - let(:text) { "test\n\n```\nint main(void) {\n return 0;\n}\n```\n" } + let(:text) { "test\n\n```\nint main(void) {\n return 0; // https://joinmastodon.org/foo\n}\n```\n" } it 'formats code using
 and ' do
           is_expected.to include '
int main'
@@ -44,13 +44,17 @@ RSpec.describe AdvancedTextFormatter do
         it 'does not strip leading spaces' do
           is_expected.to include '>  return 0'
         end
+
+        it 'does not format links' do
+          is_expected.to include 'return 0; // https://joinmastodon.org/foo'
+        end
       end
 
-      context 'given some quote' do
-        let(:text) { "> foo\n\nbar" }
+      context 'given a link in inline code using backticks' do
+        let(:text) { 'test `https://foo.bar/bar` bar' }
 
-        it 'formats code using ' do
-          is_expected.to include '

foo

' + it 'does not rewrite the link' do + is_expected.to include 'test https://foo.bar/bar bar' end end