Autofix Rubocop Style/StringLiterals (#23695)
This commit is contained in:
parent
ac3561098e
commit
81ad6c2e39
76 changed files with 277 additions and 359 deletions
|
@ -76,7 +76,7 @@ describe AccountSearchService, type: :service do
|
|||
expect(results).to eq [partial]
|
||||
end
|
||||
|
||||
it "does not return suspended remote accounts" do
|
||||
it 'does not return suspended remote accounts' do
|
||||
remote = Fabricate(:account, username: 'a', domain: 'remote', display_name: 'e', suspended: true)
|
||||
results = subject.call('a@example.com', nil, limit: 2)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
let(:note) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: "https://foo.bar/@foo/1234",
|
||||
id: 'https://foo.bar/@foo/1234',
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
|
@ -46,7 +46,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
let(:object) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: "https://foo.bar/@foo/1234",
|
||||
id: 'https://foo.bar/@foo/1234',
|
||||
type: 'Video',
|
||||
name: 'Nyan Cat 10 hours remix',
|
||||
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
|
@ -54,13 +54,13 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
{
|
||||
type: 'Link',
|
||||
mimeType: 'application/x-bittorrent',
|
||||
href: "https://foo.bar/12345.torrent",
|
||||
href: 'https://foo.bar/12345.torrent',
|
||||
},
|
||||
|
||||
{
|
||||
type: 'Link',
|
||||
mimeType: 'text/html',
|
||||
href: "https://foo.bar/watch?v=12345",
|
||||
href: 'https://foo.bar/watch?v=12345',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.url).to eq "https://foo.bar/watch?v=12345"
|
||||
expect(strip_tags(status.text)).to eq "Nyan Cat 10 hours remixhttps://foo.bar/watch?v=12345"
|
||||
expect(status.url).to eq 'https://foo.bar/watch?v=12345'
|
||||
expect(strip_tags(status.text)).to eq 'Nyan Cat 10 hours remixhttps://foo.bar/watch?v=12345'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -79,7 +79,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
let(:object) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: "https://foo.bar/@foo/1234",
|
||||
id: 'https://foo.bar/@foo/1234',
|
||||
type: 'Audio',
|
||||
name: 'Nyan Cat 10 hours remix',
|
||||
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
|
@ -87,13 +87,13 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
{
|
||||
type: 'Link',
|
||||
mimeType: 'application/x-bittorrent',
|
||||
href: "https://foo.bar/12345.torrent",
|
||||
href: 'https://foo.bar/12345.torrent',
|
||||
},
|
||||
|
||||
{
|
||||
type: 'Link',
|
||||
mimeType: 'text/html',
|
||||
href: "https://foo.bar/watch?v=12345",
|
||||
href: 'https://foo.bar/watch?v=12345',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
@ -103,8 +103,8 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.url).to eq "https://foo.bar/watch?v=12345"
|
||||
expect(strip_tags(status.text)).to eq "Nyan Cat 10 hours remixhttps://foo.bar/watch?v=12345"
|
||||
expect(status.url).to eq 'https://foo.bar/watch?v=12345'
|
||||
expect(strip_tags(status.text)).to eq 'Nyan Cat 10 hours remixhttps://foo.bar/watch?v=12345'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -112,7 +112,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
let(:object) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: "https://foo.bar/@foo/1234",
|
||||
id: 'https://foo.bar/@foo/1234',
|
||||
type: 'Event',
|
||||
name: "Let's change the world",
|
||||
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
|
@ -123,7 +123,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.url).to eq "https://foo.bar/@foo/1234"
|
||||
expect(status.url).to eq 'https://foo.bar/@foo/1234'
|
||||
expect(strip_tags(status.text)).to eq "Let's change the worldhttps://foo.bar/@foo/1234"
|
||||
end
|
||||
end
|
||||
|
@ -132,7 +132,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
let(:note) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: "https://real.address/@foo/1234",
|
||||
id: 'https://real.address/@foo/1234',
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
|
@ -154,7 +154,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
let(:object) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: "https://foo.bar/@foo/1234/create",
|
||||
id: 'https://foo.bar/@foo/1234/create',
|
||||
type: 'Create',
|
||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
object: note,
|
||||
|
@ -174,11 +174,11 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
let(:object) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: "https://foo.bar/@foo/1234/create",
|
||||
id: 'https://foo.bar/@foo/1234/create',
|
||||
type: 'Create',
|
||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
object: {
|
||||
id: "https://real.address/@foo/1234",
|
||||
id: 'https://real.address/@foo/1234',
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
attributedTo: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
|
@ -208,7 +208,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
let(:object) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: "https://foo.bar/@foo/1234/create",
|
||||
id: 'https://foo.bar/@foo/1234/create',
|
||||
type: 'Create',
|
||||
actor: ActivityPub::TagManager.instance.uri_for(sender),
|
||||
object: note.merge(updated: '2021-09-08T22:39:25Z'),
|
||||
|
@ -233,7 +233,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
let(:object) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: "https://foo.bar/@foo/1",
|
||||
id: 'https://foo.bar/@foo/1',
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
inReplyTo: 'https://foo.bar/@foo/2',
|
||||
|
@ -269,7 +269,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
|
|||
let(:object) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: "https://foo.bar/@foo/1",
|
||||
id: 'https://foo.bar/@foo/1',
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
replies: {
|
||||
|
|
|
@ -59,8 +59,8 @@ RSpec.describe DeleteAccountService, type: :service do
|
|||
|
||||
describe '#call on local account' do
|
||||
before do
|
||||
stub_request(:post, "https://alice.com/inbox").to_return(status: 201)
|
||||
stub_request(:post, "https://bob.com/inbox").to_return(status: 201)
|
||||
stub_request(:post, 'https://alice.com/inbox').to_return(status: 201)
|
||||
stub_request(:post, 'https://bob.com/inbox').to_return(status: 201)
|
||||
end
|
||||
|
||||
let!(:remote_alice) { Fabricate(:account, inbox_url: 'https://alice.com/inbox', protocol: :activitypub) }
|
||||
|
@ -72,16 +72,16 @@ RSpec.describe DeleteAccountService, type: :service do
|
|||
|
||||
it 'sends a delete actor activity to all known inboxes' do
|
||||
subject
|
||||
expect(a_request(:post, "https://alice.com/inbox")).to have_been_made.once
|
||||
expect(a_request(:post, "https://bob.com/inbox")).to have_been_made.once
|
||||
expect(a_request(:post, 'https://alice.com/inbox')).to have_been_made.once
|
||||
expect(a_request(:post, 'https://bob.com/inbox')).to have_been_made.once
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#call on remote account' do
|
||||
before do
|
||||
stub_request(:post, "https://alice.com/inbox").to_return(status: 201)
|
||||
stub_request(:post, "https://bob.com/inbox").to_return(status: 201)
|
||||
stub_request(:post, 'https://alice.com/inbox').to_return(status: 201)
|
||||
stub_request(:post, 'https://bob.com/inbox').to_return(status: 201)
|
||||
end
|
||||
|
||||
include_examples 'common behavior' do
|
||||
|
|
|
@ -23,7 +23,7 @@ RSpec.describe FavouriteService, type: :service do
|
|||
let(:status) { Fabricate(:status, account: bob) }
|
||||
|
||||
before do
|
||||
stub_request(:post, "http://example.com/inbox").to_return(status: 200, body: "", headers: {})
|
||||
stub_request(:post, 'http://example.com/inbox').to_return(status: 200, body: '', headers: {})
|
||||
subject.call(sender, status)
|
||||
end
|
||||
|
||||
|
@ -32,7 +32,7 @@ RSpec.describe FavouriteService, type: :service do
|
|||
end
|
||||
|
||||
it 'sends a like activity' do
|
||||
expect(a_request(:post, "http://example.com/inbox")).to have_been_made.once
|
||||
expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ RSpec.describe FetchLinkCardService, type: :service do
|
|||
|
||||
it 'works with SJIS' do
|
||||
expect(a_request(:get, 'http://example.com/sjis')).to have_been_made.at_least_once
|
||||
expect(status.preview_cards.first.title).to eq("SJISのページ")
|
||||
expect(status.preview_cards.first.title).to eq('SJISのページ')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -39,7 +39,7 @@ RSpec.describe FetchLinkCardService, type: :service do
|
|||
|
||||
it 'works with SJIS even with wrong charset header' do
|
||||
expect(a_request(:get, 'http://example.com/sjis_with_wrong_charset')).to have_been_made.at_least_once
|
||||
expect(status.preview_cards.first.title).to eq("SJISのページ")
|
||||
expect(status.preview_cards.first.title).to eq('SJISのページ')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -48,7 +48,7 @@ RSpec.describe FetchLinkCardService, type: :service do
|
|||
|
||||
it 'works with koi8-r' do
|
||||
expect(a_request(:get, 'http://example.com/koi8-r')).to have_been_made.at_least_once
|
||||
expect(status.preview_cards.first.title).to eq("Московя начинаетъ только въ XVI ст. привлекать внимане иностранцевъ.")
|
||||
expect(status.preview_cards.first.title).to eq('Московя начинаетъ только въ XVI ст. привлекать внимане иностранцевъ.')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -66,7 +66,7 @@ RSpec.describe FetchLinkCardService, type: :service do
|
|||
|
||||
it 'works with Japanese path string' do
|
||||
expect(a_request(:get, 'http://example.com/日本語')).to have_been_made.at_least_once
|
||||
expect(status.preview_cards.first.title).to eq("SJISのページ")
|
||||
expect(status.preview_cards.first.title).to eq('SJISのページ')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ describe FetchOEmbedService, type: :service do
|
|||
subject { described_class.new }
|
||||
|
||||
before do
|
||||
stub_request(:get, "https://host.test/provider.json").to_return(status: 404)
|
||||
stub_request(:get, "https://host.test/provider.xml").to_return(status: 404)
|
||||
stub_request(:get, "https://host.test/empty_provider.json").to_return(status: 200)
|
||||
stub_request(:get, 'https://host.test/provider.json').to_return(status: 404)
|
||||
stub_request(:get, 'https://host.test/provider.xml').to_return(status: 404)
|
||||
stub_request(:get, 'https://host.test/empty_provider.json').to_return(status: 200)
|
||||
end
|
||||
|
||||
describe 'discover_provider' do
|
||||
|
|
|
@ -7,7 +7,7 @@ RSpec.describe FetchRemoteStatusService, type: :service do
|
|||
let(:note) do
|
||||
{
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: "https://example.org/@foo/1234",
|
||||
id: 'https://example.org/@foo/1234',
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
attributedTo: ActivityPub::TagManager.instance.uri_for(account),
|
||||
|
|
|
@ -140,7 +140,7 @@ RSpec.describe FollowService, type: :service do
|
|||
let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com', protocol: :activitypub, inbox_url: 'http://example.com/inbox') }
|
||||
|
||||
before do
|
||||
stub_request(:post, "http://example.com/inbox").to_return(status: 200, body: "", headers: {})
|
||||
stub_request(:post, 'http://example.com/inbox').to_return(status: 200, body: '', headers: {})
|
||||
subject.call(sender, bob)
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe ImportService, type: :service do
|
|||
let!(:eve) { Fabricate(:account, username: 'eve', domain: 'example.com', locked: false, protocol: :activitypub, inbox_url: 'https://example.com/inbox') }
|
||||
|
||||
before do
|
||||
stub_request(:post, "https://example.com/inbox").to_return(status: 200)
|
||||
stub_request(:post, 'https://example.com/inbox').to_return(status: 200)
|
||||
end
|
||||
|
||||
context 'import old-style list of muted users' do
|
||||
|
@ -186,7 +186,7 @@ RSpec.describe ImportService, type: :service do
|
|||
|
||||
# Make sure to not actually go to the remote server
|
||||
before do
|
||||
stub_request(:post, "https://թութ.հայ/inbox").to_return(status: 200)
|
||||
stub_request(:post, 'https://թութ.հայ/inbox').to_return(status: 200)
|
||||
end
|
||||
|
||||
let(:csv) { attachment_fixture('utf8-followers.txt') }
|
||||
|
|
|
@ -5,7 +5,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
|
||||
it 'creates a new status' do
|
||||
account = Fabricate(:account)
|
||||
text = "test status update"
|
||||
text = 'test status update'
|
||||
|
||||
status = subject.call(account, text: text)
|
||||
|
||||
|
@ -16,7 +16,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
it 'creates a new response status' do
|
||||
in_reply_to_status = Fabricate(:status)
|
||||
account = Fabricate(:account)
|
||||
text = "test status update"
|
||||
text = 'test status update'
|
||||
|
||||
status = subject.call(account, text: text, thread: in_reply_to_status)
|
||||
|
||||
|
@ -58,7 +58,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
boosted_status = Fabricate(:status)
|
||||
in_reply_to_status = Fabricate(:status, reblog: boosted_status)
|
||||
account = Fabricate(:account)
|
||||
text = "test status update"
|
||||
text = 'test status update'
|
||||
|
||||
status = subject.call(account, text: text, thread: in_reply_to_status)
|
||||
|
||||
|
@ -75,7 +75,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
end
|
||||
|
||||
it 'creates a status with spoiler text' do
|
||||
spoiler_text = "spoiler text"
|
||||
spoiler_text = 'spoiler text'
|
||||
|
||||
status = create_status_with_options(spoiler_text: spoiler_text)
|
||||
|
||||
|
@ -101,14 +101,14 @@ RSpec.describe PostStatusService, type: :service do
|
|||
status = create_status_with_options(visibility: :private)
|
||||
|
||||
expect(status).to be_persisted
|
||||
expect(status.visibility).to eq "private"
|
||||
expect(status.visibility).to eq 'private'
|
||||
end
|
||||
|
||||
it 'creates a status with limited visibility for silenced users' do
|
||||
status = subject.call(Fabricate(:account, silenced: true), text: 'test', visibility: :public)
|
||||
|
||||
expect(status).to be_persisted
|
||||
expect(status.visibility).to eq "unlisted"
|
||||
expect(status.visibility).to eq 'unlisted'
|
||||
end
|
||||
|
||||
it 'creates a status for the given application' do
|
||||
|
@ -135,7 +135,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
allow(ProcessMentionsService).to receive(:new).and_return(mention_service)
|
||||
account = Fabricate(:account)
|
||||
|
||||
status = subject.call(account, text: "test status update")
|
||||
status = subject.call(account, text: 'test status update')
|
||||
|
||||
expect(ProcessMentionsService).to have_received(:new)
|
||||
expect(mention_service).to have_received(:call).with(status, save_records: false)
|
||||
|
@ -166,7 +166,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
allow(ProcessHashtagsService).to receive(:new).and_return(hashtags_service)
|
||||
account = Fabricate(:account)
|
||||
|
||||
status = subject.call(account, text: "test status update")
|
||||
status = subject.call(account, text: 'test status update')
|
||||
|
||||
expect(ProcessHashtagsService).to have_received(:new)
|
||||
expect(hashtags_service).to have_received(:call).with(status)
|
||||
|
@ -178,7 +178,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
|
||||
account = Fabricate(:account)
|
||||
|
||||
status = subject.call(account, text: "test status update")
|
||||
status = subject.call(account, text: 'test status update')
|
||||
|
||||
expect(DistributionWorker).to have_received(:perform_async).with(status.id)
|
||||
expect(ActivityPub::DistributionWorker).to have_received(:perform_async).with(status.id)
|
||||
|
@ -188,7 +188,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
allow(LinkCrawlWorker).to receive(:perform_async)
|
||||
account = Fabricate(:account)
|
||||
|
||||
status = subject.call(account, text: "test status update")
|
||||
status = subject.call(account, text: 'test status update')
|
||||
|
||||
expect(LinkCrawlWorker).to have_received(:perform_async).with(status.id)
|
||||
end
|
||||
|
@ -199,7 +199,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
|
||||
status = subject.call(
|
||||
account,
|
||||
text: "test status update",
|
||||
text: 'test status update',
|
||||
media_ids: [media.id]
|
||||
)
|
||||
|
||||
|
@ -212,7 +212,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
|
||||
status = subject.call(
|
||||
account,
|
||||
text: "test status update",
|
||||
text: 'test status update',
|
||||
media_ids: [media.id]
|
||||
)
|
||||
|
||||
|
@ -225,7 +225,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
expect do
|
||||
subject.call(
|
||||
account,
|
||||
text: "test status update",
|
||||
text: 'test status update',
|
||||
media_ids: [
|
||||
Fabricate(:media_attachment, account: account),
|
||||
Fabricate(:media_attachment, account: account),
|
||||
|
@ -250,7 +250,7 @@ RSpec.describe PostStatusService, type: :service do
|
|||
expect do
|
||||
subject.call(
|
||||
account,
|
||||
text: "test status update",
|
||||
text: 'test status update',
|
||||
media_ids: [
|
||||
video,
|
||||
image,
|
||||
|
|
|
@ -62,7 +62,7 @@ RSpec.describe ProcessMentionsService, type: :service do
|
|||
|
||||
context 'with an IDN domain' do
|
||||
let!(:remote_user) { Fabricate(:account, username: 'sneak', protocol: :activitypub, domain: 'xn--hresiar-mxa.ch', inbox_url: 'http://example.com/inbox') }
|
||||
let!(:status) { Fabricate(:status, account: account, text: "Hello @sneak@hæresiar.ch") }
|
||||
let!(:status) { Fabricate(:status, account: account, text: 'Hello @sneak@hæresiar.ch') }
|
||||
|
||||
before do
|
||||
subject.call(status)
|
||||
|
@ -75,7 +75,7 @@ RSpec.describe ProcessMentionsService, type: :service do
|
|||
|
||||
context 'with an IDN TLD' do
|
||||
let!(:remote_user) { Fabricate(:account, username: 'foo', protocol: :activitypub, domain: 'xn--y9a3aq.xn--y9a3aq', inbox_url: 'http://example.com/inbox') }
|
||||
let!(:status) { Fabricate(:status, account: account, text: "Hello @foo@հայ.հայ") }
|
||||
let!(:status) { Fabricate(:status, account: account, text: 'Hello @foo@հայ.հայ') }
|
||||
|
||||
before do
|
||||
subject.call(status)
|
||||
|
@ -91,8 +91,8 @@ RSpec.describe ProcessMentionsService, type: :service 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
|
||||
stub_request(:get, "https://example.com/.well-known/host-meta").to_return(status: 404)
|
||||
stub_request(:get, "https://example.com/.well-known/webfinger?resource=acct:remote_user@example.com").to_return(status: 500)
|
||||
stub_request(:get, 'https://example.com/.well-known/host-meta').to_return(status: 404)
|
||||
stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:remote_user@example.com').to_return(status: 500)
|
||||
subject.call(status)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ RSpec.describe ResolveAccountService, type: :service do
|
|||
subject { described_class.new }
|
||||
|
||||
before do
|
||||
stub_request(:get, "https://example.com/.well-known/host-meta").to_return(status: 404)
|
||||
stub_request(:get, "https://quitter.no/avatar/7477-300-20160211190340.png").to_return(request_fixture('avatar.txt'))
|
||||
stub_request(:get, "https://ap.example.com/.well-known/webfinger?resource=acct:foo@ap.example.com").to_return(request_fixture('activitypub-webfinger.txt'))
|
||||
stub_request(:get, "https://ap.example.com/users/foo").to_return(request_fixture('activitypub-actor.txt'))
|
||||
stub_request(:get, "https://ap.example.com/users/foo.atom").to_return(request_fixture('activitypub-feed.txt'))
|
||||
stub_request(:get, 'https://example.com/.well-known/host-meta').to_return(status: 404)
|
||||
stub_request(:get, 'https://quitter.no/avatar/7477-300-20160211190340.png').to_return(request_fixture('avatar.txt'))
|
||||
stub_request(:get, 'https://ap.example.com/.well-known/webfinger?resource=acct:foo@ap.example.com').to_return(request_fixture('activitypub-webfinger.txt'))
|
||||
stub_request(:get, 'https://ap.example.com/users/foo').to_return(request_fixture('activitypub-actor.txt'))
|
||||
stub_request(:get, 'https://ap.example.com/users/foo.atom').to_return(request_fixture('activitypub-feed.txt'))
|
||||
stub_request(:get, %r{https://ap.example.com/users/foo/\w+}).to_return(status: 404)
|
||||
stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:hoge@example.com').to_return(status: 410)
|
||||
end
|
||||
|
@ -56,8 +56,8 @@ RSpec.describe ResolveAccountService, type: :service do
|
|||
|
||||
context 'when there is an LRDD endpoint but no resolvable account' do
|
||||
before do
|
||||
stub_request(:get, "https://quitter.no/.well-known/host-meta").to_return(request_fixture('.host-meta.txt'))
|
||||
stub_request(:get, "https://quitter.no/.well-known/webfinger?resource=acct:catsrgr8@quitter.no").to_return(status: 404)
|
||||
stub_request(:get, 'https://quitter.no/.well-known/host-meta').to_return(request_fixture('.host-meta.txt'))
|
||||
stub_request(:get, 'https://quitter.no/.well-known/webfinger?resource=acct:catsrgr8@quitter.no').to_return(status: 404)
|
||||
end
|
||||
|
||||
it 'returns nil' do
|
||||
|
@ -67,7 +67,7 @@ RSpec.describe ResolveAccountService, type: :service do
|
|||
|
||||
context 'when there is no LRDD endpoint nor resolvable account' do
|
||||
before do
|
||||
stub_request(:get, "https://example.com/.well-known/webfinger?resource=acct:catsrgr8@example.com").to_return(status: 404)
|
||||
stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:catsrgr8@example.com').to_return(status: 404)
|
||||
end
|
||||
|
||||
it 'returns nil' do
|
||||
|
@ -153,7 +153,7 @@ RSpec.describe ResolveAccountService, type: :service do
|
|||
|
||||
context 'with multiple types' do
|
||||
before do
|
||||
stub_request(:get, "https://ap.example.com/users/foo").to_return(request_fixture('activitypub-actor-individual.txt'))
|
||||
stub_request(:get, 'https://ap.example.com/users/foo').to_return(request_fixture('activitypub-actor-individual.txt'))
|
||||
end
|
||||
|
||||
it 'returns new remote account' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue