0
0
Fork 0
This commit is contained in:
aus-social 2018-10-04 20:36:53 +10:00 committed by Eugen Rochko
parent 928102284a
commit 1f98eae1cf
56 changed files with 55 additions and 79 deletions

View file

@ -393,7 +393,7 @@ RSpec.describe FeedManager do
end
it 'sends push updates' do
status = Fabricate(:status)
status = Fabricate(:status)
FeedManager.instance.push_to_home(receiver, status)

View file

@ -170,12 +170,11 @@ RSpec.describe Formatter do
end
end
describe '#format_spoiler' do
subject { Formatter.instance.format_spoiler(status) }
context 'given a post containing plain text' do
let(:status) { Fabricate(:status, text: 'text', spoiler_text: 'Secret!', uri: nil) }
let(:status) { Fabricate(:status, text: 'text', spoiler_text: 'Secret!', uri: nil) }
it 'Returns the spoiler text' do
is_expected.to eq 'Secret!'
@ -184,7 +183,7 @@ RSpec.describe Formatter do
context 'given a post with an emoji shortcode at the start' do
let!(:emoji) { Fabricate(:custom_emoji) }
let(:status) { Fabricate(:status, text: 'text', spoiler_text: ':coolcat: Secret!', uri: nil) }
let(:status) { Fabricate(:status, text: 'text', spoiler_text: ':coolcat: Secret!', uri: nil) }
let(:text) { ':coolcat: Beep boop' }
it 'converts the shortcode to an image tag' do
@ -207,7 +206,7 @@ RSpec.describe Formatter do
end
context 'given a post containing plain text' do
let(:status) { Fabricate(:status, text: 'text', uri: nil) }
let(:status) { Fabricate(:status, text: 'text', uri: nil) }
it 'paragraphizes the text' do
is_expected.to eq '<p>text</p>'
@ -215,7 +214,7 @@ RSpec.describe Formatter do
end
context 'given a post containing line feeds' do
let(:status) { Fabricate(:status, text: "line\nfeed", uri: nil) }
let(:status) { Fabricate(:status, text: "line\nfeed", uri: nil) }
it 'removes line feeds' do
is_expected.not_to include "\n"
@ -367,7 +366,7 @@ 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>', uri: nil) }
it 'returns the raw text' do
is_expected.to eq '<p>a text by a nerd who uses an HTML tag in text</p>'
@ -375,7 +374,7 @@ RSpec.describe Formatter do
end
context 'given a post with remote status' do
let(:status) { Fabricate(:status, account: remote_account, text: '<script>alert("Hello")</script>') }
let(:status) { Fabricate(:status, account: remote_account, text: '<script>alert("Hello")</script>') }
it 'returns tag-stripped text' do
is_expected.to eq ''

View file

@ -90,7 +90,7 @@ describe LanguageDetector do
end
it 'uses nil when account is present but has no locale' do
result = described_class.instance.detect('', account_without_user_locale)
result = described_class.instance.detect('', account_without_user_locale)
expect(result).to eq nil
end

View file

@ -880,7 +880,7 @@ RSpec.describe OStatus::AtomSerializer do
ProcessInteractionService.new.call(envelope, block.target_account)
expect{ block.reload }.to raise_error ActiveRecord::RecordNotFound
expect { block.reload }.to raise_error ActiveRecord::RecordNotFound
end
end

View file

@ -84,7 +84,7 @@ describe Request do
allow(Addrinfo).to receive(:foreach).with('example.com', nil, nil, :SOCK_STREAM)
.and_yield(Addrinfo.new(["AF_INET", 0, "example.com", "0.0.0.0"], :PF_INET, :SOCK_STREAM))
.and_yield(Addrinfo.new(["AF_INET6", 0, "example.com", "2001:db8::face"], :PF_INET6, :SOCK_STREAM))
expect{ subject.perform }.to raise_error Mastodon::ValidationError
expect { subject.perform }.to raise_error Mastodon::ValidationError
end
end
end