diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-10-21 02:37:20 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-10-21 02:37:20 -0500 |
commit | 8e0ae20e607775840e94605f71c5c480cfa97ddf (patch) | |
tree | 0016cd08f4504ebd66149240b406c34e383c3332 /spec/lib | |
parent | 974b3805b7d6dd27730846847e19bc4204f16dc6 (diff) | |
parent | 29870d2be6c0e78132416b5561aba20d6ca3c746 (diff) |
Merge remote-tracking branch 'upstream/master' into dev
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/formatter_spec.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/lib/formatter_spec.rb b/spec/lib/formatter_spec.rb index 633d59c2a..efefb8f00 100644 --- a/spec/lib/formatter_spec.rb +++ b/spec/lib/formatter_spec.rb @@ -336,11 +336,22 @@ RSpec.describe Formatter do end context do + let(:content_type) { 'text/plain' } + subject do - status = Fabricate(:status, text: text, uri: nil) + status = Fabricate(:status, text: text, content_type: content_type, uri: nil) Formatter.instance.format(status) end + context 'given an invalid URL (invalid port)' do + let(:text) { 'https://foo.bar:X/' } + let(:content_type) { 'text/markdown' } + + it 'outputs the raw URL' do + is_expected.to eq '<p>https://foo.bar:X/</p>' + end + end + include_examples 'encode and link URLs' end @@ -464,7 +475,8 @@ RSpec.describe Formatter do subject { Formatter.instance.plaintext(status) } context 'given a post with local status' do - let(:status) { Fabricate(:status, text: '<p>a text by a nerd who uses an HTML tag in text</p>', uri: nil) } + let(:status) { Fabricate(:status, text: '<p>a text by a nerd who uses an HTML tag in text</p>', content_type: content_type, uri: nil) } + let(:content_type) { 'text/plain' } it 'returns the raw text' do is_expected.to eq '<p>a text by a nerd who uses an HTML tag in text</p>' |