diff --git a/spec/lib/plain_text_formatter_spec.rb b/spec/lib/plain_text_formatter_spec.rb index b22f473d0..4683e1509 100644 --- a/spec/lib/plain_text_formatter_spec.rb +++ b/spec/lib/plain_text_formatter_spec.rb @@ -7,7 +7,7 @@ RSpec.describe PlainTextFormatter do subject { described_class.new(status.text, status.local?).to_s } context 'when status is local' do - let(:status) { Fabricate(:status, text: '

a text by a nerd who uses an HTML tag in text

', uri: nil) } + let(:status) { Fabricate.build(:status, text: '

a text by a nerd who uses an HTML tag in text

', uri: nil) } it 'returns the raw text' do expect(subject).to eq '

a text by a nerd who uses an HTML tag in text

' @@ -15,10 +15,10 @@ RSpec.describe PlainTextFormatter do end context 'when status is remote' do - let(:remote_account) { Fabricate(:account, domain: 'remote.test', username: 'bob', url: 'https://remote.test/') } + let(:remote_account) { Fabricate.build(:account, domain: 'remote.test', username: 'bob', url: 'https://remote.test/') } context 'when text contains inline HTML tags' do - let(:status) { Fabricate(:status, account: remote_account, text: 'Lorem ipsum') } + let(:status) { Fabricate.build(:status, account: remote_account, text: 'Lorem ipsum') } it 'strips the tags' do expect(subject).to eq 'Lorem ipsum' @@ -26,7 +26,7 @@ RSpec.describe PlainTextFormatter do end context 'when text contains

tags' do - let(:status) { Fabricate(:status, account: remote_account, text: '

Lorem

ipsum

') } + let(:status) { Fabricate.build(:status, account: remote_account, text: '

Lorem

ipsum

') } it 'inserts a newline' do expect(subject).to eq "Lorem\nipsum" @@ -34,7 +34,7 @@ RSpec.describe PlainTextFormatter do end context 'when text contains a single
tag' do - let(:status) { Fabricate(:status, account: remote_account, text: 'Lorem
ipsum') } + let(:status) { Fabricate.build(:status, account: remote_account, text: 'Lorem
ipsum') } it 'inserts a newline' do expect(subject).to eq "Lorem\nipsum" @@ -42,7 +42,7 @@ RSpec.describe PlainTextFormatter do end context 'when text contains consecutive
tag' do - let(:status) { Fabricate(:status, account: remote_account, text: 'Lorem


ipsum') } + let(:status) { Fabricate.build(:status, account: remote_account, text: 'Lorem


ipsum') } it 'inserts a single newline' do expect(subject).to eq "Lorem\nipsum" @@ -50,7 +50,7 @@ RSpec.describe PlainTextFormatter do end context 'when text contains HTML entity' do - let(:status) { Fabricate(:status, account: remote_account, text: 'Lorem & ipsum ❤') } + let(:status) { Fabricate.build(:status, account: remote_account, text: 'Lorem & ipsum ❤') } it 'unescapes the entity' do expect(subject).to eq 'Lorem & ipsum ❤' @@ -58,7 +58,7 @@ RSpec.describe PlainTextFormatter do end context 'when text contains ipsum') } + let(:status) { Fabricate.build(:status, account: remote_account, text: 'Lorem ipsum') } it 'strips the tag and its contents' do expect(subject).to eq 'Lorem ipsum' @@ -66,7 +66,7 @@ RSpec.describe PlainTextFormatter do end context 'when text contains an HTML comment tags' do - let(:status) { Fabricate(:status, account: remote_account, text: 'Lorem ipsum') } + let(:status) { Fabricate.build(:status, account: remote_account, text: 'Lorem ipsum') } it 'strips the comment' do expect(subject).to eq 'Lorem ipsum' @@ -74,7 +74,7 @@ RSpec.describe PlainTextFormatter do end context 'when text contains HTML ruby tags' do - let(:status) { Fabricate(:status, account: remote_account, text: '

Lorem 明日 (Ashita) ipsum

') } + let(:status) { Fabricate.build(:status, account: remote_account, text: '

Lorem 明日 (Ashita) ipsum

') } it 'strips the comment' do expect(subject).to eq 'Lorem 明日 (Ashita) ipsum'