Fix RSpec/ContextWording cop (#24739)
This commit is contained in:
parent
cf18cc2891
commit
710745e16b
105 changed files with 559 additions and 668 deletions
|
@ -20,7 +20,7 @@ describe AccountSearchService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'searching for a simple term that is not an exact match' do
|
||||
context 'when searching for a simple term that is not an exact match' do
|
||||
it 'does not return a nil entry in the array for the exact match' do
|
||||
account = Fabricate(:account, username: 'matchingusername')
|
||||
results = subject.call('match', nil, limit: 5)
|
||||
|
|
|
@ -20,13 +20,13 @@ describe AccountStatusesCleanupService, type: :service do
|
|||
let!(:another_old_status) { Fabricate(:status, created_at: 1.year.ago, account: account) }
|
||||
let!(:recent_status) { Fabricate(:status, created_at: 1.day.ago, account: account) }
|
||||
|
||||
context 'given a budget of 1' do
|
||||
context 'when given a budget of 1' do
|
||||
it 'reports 1 deleted toot' do
|
||||
expect(subject.call(account_policy, 1)).to eq 1
|
||||
end
|
||||
end
|
||||
|
||||
context 'given a normal budget of 10' do
|
||||
context 'when given a normal budget of 10' do
|
||||
it 'reports 3 deleted statuses' do
|
||||
expect(subject.call(account_policy, 10)).to eq 3
|
||||
end
|
||||
|
|
|
@ -226,12 +226,12 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'statuses referencing other statuses' do
|
||||
context 'with statuses referencing other statuses' do
|
||||
before do
|
||||
stub_const 'ActivityPub::FetchRemoteStatusService::DISCOVERIES_PER_REQUEST', 5
|
||||
end
|
||||
|
||||
context 'using inReplyTo' do
|
||||
context 'when using inReplyTo' do
|
||||
let(:object) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
|
@ -267,7 +267,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'using replies' do
|
||||
context 'when using replies' do
|
||||
let(:object) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
context 'property values' do
|
||||
context 'with property values' do
|
||||
let(:payload) do
|
||||
{
|
||||
id: 'https://foo.test',
|
||||
|
@ -82,7 +82,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
|||
account.suspend!(origin: suspension_origin)
|
||||
end
|
||||
|
||||
context 'locally' do
|
||||
context 'when locally' do
|
||||
let(:suspension_origin) { :local }
|
||||
|
||||
it 'does not unsuspend it' do
|
||||
|
@ -94,7 +94,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'remotely' do
|
||||
context 'when remotely' do
|
||||
let(:suspension_origin) { :remote }
|
||||
|
||||
it 'unsuspends it' do
|
||||
|
@ -112,7 +112,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'discovering many subdomains in a short timeframe' do
|
||||
context 'when discovering many subdomains in a short timeframe' do
|
||||
before do
|
||||
stub_const 'ActivityPub::ProcessAccountService::SUBDOMAINS_RATELIMIT', 5
|
||||
end
|
||||
|
@ -138,7 +138,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'accounts referencing other accounts' do
|
||||
context 'when Accounts referencing other accounts' do
|
||||
before do
|
||||
stub_const 'ActivityPub::ProcessAccountService::DISCOVERIES_PER_REQUEST', 5
|
||||
end
|
||||
|
|
|
@ -269,7 +269,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'originally without tags' do
|
||||
context 'when originally without tags' do
|
||||
before do
|
||||
subject.call(status, json)
|
||||
end
|
||||
|
@ -279,7 +279,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'originally with tags' do
|
||||
context 'when originally with tags' do
|
||||
let(:tags) { [Fabricate(:tag, name: 'test'), Fabricate(:tag, name: 'foo')] }
|
||||
|
||||
let(:payload) do
|
||||
|
@ -305,7 +305,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'originally without mentions' do
|
||||
context 'when originally without mentions' do
|
||||
before do
|
||||
subject.call(status, json)
|
||||
end
|
||||
|
@ -315,7 +315,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'originally with mentions' do
|
||||
context 'when originally with mentions' do
|
||||
let(:mentions) { [alice, bob] }
|
||||
|
||||
before do
|
||||
|
@ -327,7 +327,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'originally without media attachments' do
|
||||
context 'when originally without media attachments' do
|
||||
before do
|
||||
stub_request(:get, 'https://example.com/foo.png').to_return(body: attachment_fixture('emojo.png'))
|
||||
subject.call(status, json)
|
||||
|
@ -362,7 +362,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'originally with media attachments' do
|
||||
context 'when originally with media attachments' do
|
||||
let(:media_attachments) { [Fabricate(:media_attachment, remote_url: 'https://example.com/foo.png'), Fabricate(:media_attachment, remote_url: 'https://example.com/unused.png')] }
|
||||
|
||||
let(:payload) do
|
||||
|
@ -404,7 +404,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'originally with a poll' do
|
||||
context 'when originally with a poll' do
|
||||
before do
|
||||
poll = Fabricate(:poll, status: status)
|
||||
status.update(preloadable_poll: poll)
|
||||
|
@ -420,7 +420,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'originally without a poll' do
|
||||
context 'when originally without a poll' do
|
||||
let(:payload) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
|
|
|
@ -18,7 +18,7 @@ RSpec.describe FetchLinkCardService, type: :service do
|
|||
subject.call(status)
|
||||
end
|
||||
|
||||
context 'in a local status' do
|
||||
context 'with a local status' do
|
||||
context do
|
||||
let(:status) { Fabricate(:status, text: 'Check out http://example.中国') }
|
||||
|
||||
|
@ -89,7 +89,7 @@ RSpec.describe FetchLinkCardService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'in a remote status' do
|
||||
context 'with a remote status' do
|
||||
let(:status) { Fabricate(:status, account: Fabricate(:account, domain: 'example.com'), text: 'Habt ihr ein paar gute Links zu <a>foo</a> #<span class="tag"><a href="https://quitter.se/tag/wannacry" target="_blank" rel="tag noopener noreferrer" title="https://quitter.se/tag/wannacry">Wannacry</a></span> herumfliegen? Ich will mal unter <br> <a href="https://github.com/qbi/WannaCry" target="_blank" rel="noopener noreferrer" title="https://github.com/qbi/WannaCry">https://github.com/qbi/WannaCry</a> was sammeln. !<a href="http://sn.jonkman.ca/group/416/id" target="_blank" rel="noopener noreferrer" title="http://sn.jonkman.ca/group/416/id">security</a> ') }
|
||||
|
||||
it 'parses out URLs' do
|
||||
|
|
|
@ -39,7 +39,7 @@ describe FetchOEmbedService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'Both of JSON and XML provider are discoverable' do
|
||||
context 'when both of JSON and XML provider are discoverable' do
|
||||
before do
|
||||
stub_request(:get, 'https://host.test/oembed.html').to_return(
|
||||
status: 200,
|
||||
|
@ -66,7 +66,7 @@ describe FetchOEmbedService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'JSON provider is discoverable while XML provider is not' do
|
||||
context 'when JSON provider is discoverable while XML provider is not' do
|
||||
before do
|
||||
stub_request(:get, 'https://host.test/oembed.html').to_return(
|
||||
status: 200,
|
||||
|
@ -87,7 +87,7 @@ describe FetchOEmbedService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'XML provider is discoverable while JSON provider is not' do
|
||||
context 'when XML provider is discoverable while JSON provider is not' do
|
||||
before do
|
||||
stub_request(:get, 'https://host.test/oembed.html').to_return(
|
||||
status: 200,
|
||||
|
@ -108,7 +108,7 @@ describe FetchOEmbedService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'Invalid XML provider is discoverable while JSON provider is not' do
|
||||
context 'with Invalid XML provider is discoverable while JSON provider is not' do
|
||||
before do
|
||||
stub_request(:get, 'https://host.test/oembed.html').to_return(
|
||||
status: 200,
|
||||
|
@ -122,7 +122,7 @@ describe FetchOEmbedService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'Neither of JSON and XML provider is discoverable' do
|
||||
context 'with neither of JSON and XML provider is discoverable' do
|
||||
before do
|
||||
stub_request(:get, 'https://host.test/oembed.html').to_return(
|
||||
status: 200,
|
||||
|
@ -136,7 +136,7 @@ describe FetchOEmbedService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'Empty JSON provider is discoverable' do
|
||||
context 'when empty JSON provider is discoverable' do
|
||||
before do
|
||||
stub_request(:get, 'https://host.test/oembed.html').to_return(
|
||||
status: 200,
|
||||
|
|
|
@ -16,7 +16,7 @@ RSpec.describe FetchRemoteStatusService, type: :service do
|
|||
}
|
||||
end
|
||||
|
||||
context 'protocol is :activitypub' do
|
||||
context 'when protocol is :activitypub' do
|
||||
subject { described_class.new.call(note[:id], prefetched_body: prefetched_body) }
|
||||
|
||||
let(:prefetched_body) { Oj.dump(note) }
|
||||
|
|
|
@ -7,7 +7,7 @@ RSpec.describe FollowService, type: :service do
|
|||
|
||||
let(:sender) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
context 'local account' do
|
||||
context 'when local account' do
|
||||
describe 'locked account' do
|
||||
let(:bob) { Fabricate(:account, locked: true, username: 'bob') }
|
||||
|
||||
|
@ -138,7 +138,7 @@ RSpec.describe FollowService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'remote ActivityPub account' do
|
||||
context 'when remote ActivityPub account' do
|
||||
let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com', protocol: :activitypub, inbox_url: 'http://example.com/inbox') }
|
||||
|
||||
before do
|
||||
|
|
|
@ -13,7 +13,7 @@ RSpec.describe ImportService, type: :service do
|
|||
stub_request(:post, 'https://example.com/inbox').to_return(status: 200)
|
||||
end
|
||||
|
||||
context 'import old-style list of muted users' do
|
||||
context 'when importing old-style list of muted users' do
|
||||
subject { ImportService.new }
|
||||
|
||||
let(:csv) { attachment_fixture('mute-imports.txt') }
|
||||
|
@ -51,7 +51,7 @@ RSpec.describe ImportService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'import new-style list of muted users' do
|
||||
context 'when importing new-style list of muted users' do
|
||||
subject { ImportService.new }
|
||||
|
||||
let(:csv) { attachment_fixture('new-mute-imports.txt') }
|
||||
|
@ -92,7 +92,7 @@ RSpec.describe ImportService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'import old-style list of followed users' do
|
||||
context 'when importing old-style list of followed users' do
|
||||
subject { ImportService.new }
|
||||
|
||||
let(:csv) { attachment_fixture('mute-imports.txt') }
|
||||
|
@ -134,7 +134,7 @@ RSpec.describe ImportService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'import new-style list of followed users' do
|
||||
context 'when importing new-style list of followed users' do
|
||||
subject { ImportService.new }
|
||||
|
||||
let(:csv) { attachment_fixture('new-following-imports.txt') }
|
||||
|
@ -181,7 +181,7 @@ RSpec.describe ImportService, type: :service do
|
|||
# Based on the bug report 20571 where UTF-8 encoded domains were rejecting import of their users
|
||||
#
|
||||
# https://github.com/mastodon/mastodon/issues/20571
|
||||
context 'utf-8 encoded domains' do
|
||||
context 'with a utf-8 encoded domains' do
|
||||
subject { ImportService.new }
|
||||
|
||||
let!(:nare) { Fabricate(:account, username: 'nare', domain: 'թութ.հայ', locked: false, protocol: :activitypub, inbox_url: 'https://թութ.հայ/inbox') }
|
||||
|
@ -200,7 +200,7 @@ RSpec.describe ImportService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'import bookmarks' do
|
||||
context 'when importing bookmarks' do
|
||||
subject { ImportService.new }
|
||||
|
||||
let(:csv) { attachment_fixture('bookmark-imports.txt') }
|
||||
|
|
|
@ -49,7 +49,7 @@ RSpec.describe NotifyService, type: :service do
|
|||
expect { subject }.to_not change(Notification, :count)
|
||||
end
|
||||
|
||||
context 'for direct messages' do
|
||||
context 'with direct messages' do
|
||||
let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, visibility: :direct)) }
|
||||
let(:type) { :mention }
|
||||
|
||||
|
@ -58,14 +58,14 @@ RSpec.describe NotifyService, type: :service do
|
|||
user.save
|
||||
end
|
||||
|
||||
context 'if recipient is supposed to be following sender' do
|
||||
context 'when recipient is supposed to be following sender' do
|
||||
let(:enabled) { true }
|
||||
|
||||
it 'does not notify' do
|
||||
expect { subject }.to_not change(Notification, :count)
|
||||
end
|
||||
|
||||
context 'if the message chain is initiated by recipient, but is not direct message' do
|
||||
context 'when the message chain is initiated by recipient, but is not direct message' do
|
||||
let(:reply_to) { Fabricate(:status, account: recipient) }
|
||||
let!(:mention) { Fabricate(:mention, account: sender, status: reply_to) }
|
||||
let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, visibility: :direct, thread: reply_to)) }
|
||||
|
@ -75,7 +75,7 @@ RSpec.describe NotifyService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'if the message chain is initiated by recipient, but without a mention to the sender, even if the sender sends multiple messages in a row' do
|
||||
context 'when the message chain is initiated by recipient, but without a mention to the sender, even if the sender sends multiple messages in a row' do
|
||||
let(:reply_to) { Fabricate(:status, account: recipient) }
|
||||
let!(:mention) { Fabricate(:mention, account: sender, status: reply_to) }
|
||||
let(:dummy_reply) { Fabricate(:status, account: sender, visibility: :direct, thread: reply_to) }
|
||||
|
@ -86,7 +86,7 @@ RSpec.describe NotifyService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'if the message chain is initiated by the recipient with a mention to the sender' do
|
||||
context 'when the message chain is initiated by the recipient with a mention to the sender' do
|
||||
let(:reply_to) { Fabricate(:status, account: recipient, visibility: :direct) }
|
||||
let!(:mention) { Fabricate(:mention, account: sender, status: reply_to) }
|
||||
let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender, visibility: :direct, thread: reply_to)) }
|
||||
|
@ -97,7 +97,7 @@ RSpec.describe NotifyService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'if recipient is NOT supposed to be following sender' do
|
||||
context 'when recipient is NOT supposed to be following sender' do
|
||||
let(:enabled) { false }
|
||||
|
||||
it 'does notify' do
|
||||
|
|
|
@ -33,10 +33,10 @@ RSpec.describe ProcessMentionsService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'resolving a mention to a remote account' do
|
||||
context 'with resolving a mention to a remote account' do
|
||||
let(:status) { Fabricate(:status, account: account, text: "Hello @#{remote_user.acct}", visibility: :public) }
|
||||
|
||||
context 'ActivityPub' do
|
||||
context 'with ActivityPub' do
|
||||
context do
|
||||
let!(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
|
||||
|
||||
|
@ -49,7 +49,7 @@ RSpec.describe ProcessMentionsService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'mentioning a user several times when not saving records' do
|
||||
context 'when mentioning a user several times when not saving records' do
|
||||
let!(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
|
||||
let(:status) { Fabricate(:status, account: account, text: "Hello @#{remote_user.acct} @#{remote_user.acct} @#{remote_user.acct}", visibility: :public) }
|
||||
|
||||
|
@ -89,7 +89,7 @@ RSpec.describe ProcessMentionsService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'Temporarily-unreachable ActivityPub user' do
|
||||
context 'with a Temporarily-unreachable ActivityPub user' do
|
||||
let!(:remote_user) { Fabricate(:account, username: 'remote_user', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox', last_webfingered_at: nil) }
|
||||
|
||||
before do
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
RSpec.describe ReblogService, type: :service do
|
||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
context 'creates a reblog with appropriate visibility' do
|
||||
context 'when creates a reblog with appropriate visibility' do
|
||||
subject { ReblogService.new }
|
||||
|
||||
let(:visibility) { :public }
|
||||
|
@ -61,7 +61,7 @@ RSpec.describe ReblogService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'ActivityPub' do
|
||||
context 'with ActivityPub' do
|
||||
subject { ReblogService.new }
|
||||
|
||||
let(:bob) { Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') }
|
||||
|
|
|
@ -7,7 +7,7 @@ RSpec.describe ReportService, type: :service do
|
|||
|
||||
let(:source_account) { Fabricate(:account) }
|
||||
|
||||
context 'for a remote account' do
|
||||
context 'with a remote account' do
|
||||
let(:remote_account) { Fabricate(:account, domain: 'example.com', protocol: :activitypub, inbox_url: 'http://example.com/inbox') }
|
||||
|
||||
before do
|
||||
|
|
|
@ -15,7 +15,7 @@ RSpec.describe ResolveAccountService, type: :service do
|
|||
stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:hoge@example.com').to_return(status: 410)
|
||||
end
|
||||
|
||||
context 'using skip_webfinger' do
|
||||
context 'when using skip_webfinger' do
|
||||
context 'when account is known' do
|
||||
let!(:remote_account) { Fabricate(:account, username: 'foo', domain: 'ap.example.com', protocol: 'activitypub') }
|
||||
|
||||
|
@ -78,7 +78,7 @@ RSpec.describe ResolveAccountService, type: :service do
|
|||
end
|
||||
|
||||
context 'when webfinger returns http gone' do
|
||||
context 'for a previously known account' do
|
||||
context 'with a previously known account' do
|
||||
before do
|
||||
Fabricate(:account, username: 'hoge', domain: 'example.com', last_webfingered_at: nil)
|
||||
allow(AccountDeletionWorker).to receive(:perform_async)
|
||||
|
@ -94,7 +94,7 @@ RSpec.describe ResolveAccountService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'for a previously unknown account' do
|
||||
context 'with a previously unknown account' do
|
||||
it 'returns nil' do
|
||||
expect(subject.call('hoge@example.com')).to be_nil
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ describe ResolveURLService, type: :service do
|
|||
expect(subject.call(url)).to eq known_account
|
||||
end
|
||||
|
||||
context 'searching for a remote private status' do
|
||||
context 'when searching for a remote private status' do
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:poster) { Fabricate(:account, domain: 'example.com') }
|
||||
let(:url) { 'https://example.com/@foo/42' }
|
||||
|
@ -95,7 +95,7 @@ describe ResolveURLService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'searching for a local private status' do
|
||||
context 'when searching for a local private status' do
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:poster) { Fabricate(:account) }
|
||||
let!(:status) { Fabricate(:status, account: poster, visibility: :private) }
|
||||
|
@ -127,7 +127,7 @@ describe ResolveURLService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'searching for a link that redirects to a local public status' do
|
||||
context 'when searching for a link that redirects to a local public status' do
|
||||
let(:account) { Fabricate(:account) }
|
||||
let(:poster) { Fabricate(:account) }
|
||||
let!(:status) { Fabricate(:status, account: poster, visibility: :public) }
|
||||
|
|
|
@ -23,7 +23,7 @@ describe SearchService, type: :service do
|
|||
@query = 'http://test.host/query'
|
||||
end
|
||||
|
||||
context 'that does not find anything' do
|
||||
context 'when it does not find anything' do
|
||||
it 'returns the empty results' do
|
||||
service = double(call: nil)
|
||||
allow(ResolveURLService).to receive(:new).and_return(service)
|
||||
|
@ -34,7 +34,7 @@ describe SearchService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'that finds an account' do
|
||||
context 'when it finds an account' do
|
||||
it 'includes the account in the results' do
|
||||
account = Account.new
|
||||
service = double(call: account)
|
||||
|
@ -46,7 +46,7 @@ describe SearchService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'that finds a status' do
|
||||
context 'when it finds a status' do
|
||||
it 'includes the status in the results' do
|
||||
status = Status.new
|
||||
service = double(call: status)
|
||||
|
@ -60,7 +60,7 @@ describe SearchService, type: :service do
|
|||
end
|
||||
|
||||
describe 'with a non-url query' do
|
||||
context 'that matches an account' do
|
||||
context 'when it matches an account' do
|
||||
it 'includes the account in the results' do
|
||||
query = 'username'
|
||||
account = Account.new
|
||||
|
@ -73,7 +73,7 @@ describe SearchService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'that matches a tag' do
|
||||
context 'when it matches a tag' do
|
||||
it 'includes the tag in the results' do
|
||||
query = '#tag'
|
||||
tag = Tag.new
|
||||
|
|
|
@ -12,7 +12,7 @@ RSpec.describe UnallowDomainService, type: :service do
|
|||
let!(:already_banned_account) { Fabricate(:account, username: 'badguy', domain: 'evil.org', suspended: true, silenced: true) }
|
||||
let!(:domain_allow) { Fabricate(:domain_allow, domain: 'evil.org') }
|
||||
|
||||
context 'in limited federation mode' do
|
||||
context 'with limited federation mode' do
|
||||
before do
|
||||
allow(subject).to receive(:whitelist_mode?).and_return(true)
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'rails_helper'
|
|||
RSpec.describe VerifyLinkService, type: :service do
|
||||
subject { described_class.new }
|
||||
|
||||
context 'given a local account' do
|
||||
context 'when given a local account' do
|
||||
let(:account) { Fabricate(:account, username: 'alice') }
|
||||
let(:field) { Account::Field.new(account, 'name' => 'Website', 'value' => 'http://example.com') }
|
||||
|
||||
|
@ -129,7 +129,7 @@ RSpec.describe VerifyLinkService, type: :service do
|
|||
end
|
||||
end
|
||||
|
||||
context 'given a remote account' do
|
||||
context 'when given a remote account' do
|
||||
let(:account) { Fabricate(:account, username: 'alice', domain: 'example.com', url: 'https://profile.example.com/alice') }
|
||||
let(:field) { Account::Field.new(account, 'name' => 'Website', 'value' => '<a href="http://example.com" rel="me"><span class="invisible">http://</span><span class="">example.com</span><span class="invisible"></span></a>') }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue