0
0
Fork 0

Reduce factory usage across spec/services area (#32098)

This commit is contained in:
Matt Jankowski 2024-10-04 10:11:15 -04:00 committed by GitHub
parent 4fe7f213a6
commit e4e07b1c34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 567 additions and 641 deletions

View file

@ -51,12 +51,11 @@ RSpec.describe ResolveURLService do
let(:url) { 'https://example.com/@foo/42' }
let(:uri) { 'https://example.com/users/foo/statuses/42' }
it 'returns status by url' do
expect(subject.call(url, on_behalf_of: account)).to eq(status)
end
it 'returns status by uri' do
expect(subject.call(uri, on_behalf_of: account)).to eq(status)
it 'returns status by URL or URI' do
expect(subject.call(url, on_behalf_of: account))
.to eq(status)
expect(subject.call(uri, on_behalf_of: account))
.to eq(status)
end
end
@ -75,12 +74,11 @@ RSpec.describe ResolveURLService do
let(:url) { 'https://example.com/@foo/42' }
let(:uri) { 'https://example.com/users/foo/statuses/42' }
it 'does not return the status by url' do
expect(subject.call(url, on_behalf_of: account)).to be_nil
end
it 'does not return the status by uri' do
expect(subject.call(uri, on_behalf_of: account)).to be_nil
it 'does not return the status by URL or URI' do
expect(subject.call(url, on_behalf_of: account))
.to be_nil
expect(subject.call(uri, on_behalf_of: account))
.to be_nil
end
end
@ -107,22 +105,20 @@ RSpec.describe ResolveURLService do
account.follow!(poster)
end
it 'returns status by url' do
expect(subject.call(url, on_behalf_of: account)).to eq(status)
end
it 'returns status by uri' do
expect(subject.call(uri, on_behalf_of: account)).to eq(status)
it 'returns status by URL or URI' do
expect(subject.call(url, on_behalf_of: account))
.to eq(status)
expect(subject.call(uri, on_behalf_of: account))
.to eq(status)
end
end
context 'when the account does not follow the poster' do
it 'does not return the status by url' do
expect(subject.call(url, on_behalf_of: account)).to be_nil
end
it 'does not return the status by uri' do
expect(subject.call(uri, on_behalf_of: account)).to be_nil
it 'does not return the status by URL or URI' do
expect(subject.call(url, on_behalf_of: account))
.to be_nil
expect(subject.call(uri, on_behalf_of: account))
.to be_nil
end
end
end