Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master

This commit is contained in:
Jenkins
2018-01-24 19:17:11 +00:00
91 changed files with 728 additions and 238 deletions

View File

@@ -30,7 +30,7 @@ describe AuthorizeFollowsController do
it 'renders error when account cant be found' do
service = double
allow(ResolveRemoteAccountService).to receive(:new).and_return(service)
allow(ResolveAccountService).to receive(:new).and_return(service)
allow(service).to receive(:call).with('missing@hostname').and_return(nil)
get :show, params: { acct: 'acct:missing@hostname' }
@@ -54,7 +54,7 @@ describe AuthorizeFollowsController do
it 'sets account from acct uri' do
account = Account.new
service = double
allow(ResolveRemoteAccountService).to receive(:new).and_return(service)
allow(ResolveAccountService).to receive(:new).and_return(service)
allow(service).to receive(:call).with('found@hostname').and_return(account)
get :show, params: { acct: 'acct:found@hostname' }

View File

@@ -17,7 +17,7 @@ RSpec.describe Settings::ImportsController, type: :controller do
describe 'POST #create' do
it 'redirects to settings path with successful following import' do
service = double(call: nil)
allow(ResolveRemoteAccountService).to receive(:new).and_return(service)
allow(ResolveAccountService).to receive(:new).and_return(service)
post :create, params: {
import: {
type: 'following',
@@ -30,7 +30,7 @@ RSpec.describe Settings::ImportsController, type: :controller do
it 'redirects to settings path with successful blocking import' do
service = double(call: nil)
allow(ResolveRemoteAccountService).to receive(:new).and_return(service)
allow(ResolveAccountService).to receive(:new).and_return(service)
post :create, params: {
import: {
type: 'blocking',

View File

@@ -185,8 +185,8 @@ RSpec.describe Account, type: :model do
expect(account.refresh!).to be_nil
end
it 'calls not ResolveRemoteAccountService#call' do
expect_any_instance_of(ResolveRemoteAccountService).not_to receive(:call).with(acct)
it 'calls not ResolveAccountService#call' do
expect_any_instance_of(ResolveAccountService).not_to receive(:call).with(acct)
account.refresh!
end
end
@@ -194,8 +194,8 @@ RSpec.describe Account, type: :model do
context 'domain is present' do
let(:domain) { 'example.com' }
it 'calls ResolveRemoteAccountService#call' do
expect_any_instance_of(ResolveRemoteAccountService).to receive(:call).with(acct).once
it 'calls ResolveAccountService#call' do
expect_any_instance_of(ResolveAccountService).to receive(:call).with(acct).once
account.refresh!
end
end

View File

@@ -123,7 +123,7 @@ describe AccountSearchService do
describe 'when there is a domain but no exact match' do
it 'follows the remote account when resolve is true' do
service = double(call: nil)
allow(ResolveRemoteAccountService).to receive(:new).and_return(service)
allow(ResolveAccountService).to receive(:new).and_return(service)
results = subject.call('newuser@remote.com', 10, nil, resolve: true)
expect(service).to have_received(:call).with('newuser@remote.com')
@@ -131,7 +131,7 @@ describe AccountSearchService do
it 'does not follow the remote account when resolve is false' do
service = double(call: nil)
allow(ResolveRemoteAccountService).to receive(:new).and_return(service)
allow(ResolveAccountService).to receive(:new).and_return(service)
results = subject.call('newuser@remote.com', 10, nil, resolve: false)
expect(service).not_to have_received(:call)

View File

@@ -1,6 +1,6 @@
require 'rails_helper'
RSpec.describe ResolveRemoteAccountService do
RSpec.describe ResolveAccountService do
subject { described_class.new }
before do

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
describe FetchRemoteResourceService do
describe ResolveURLService do
subject { described_class.new }
describe '#call' do

View File

@@ -26,7 +26,7 @@ describe SearchService do
context 'that does not find anything' do
it 'returns the empty results' do
service = double(call: nil)
allow(FetchRemoteResourceService).to receive(:new).and_return(service)
allow(ResolveURLService).to receive(:new).and_return(service)
results = subject.call(@query, 10)
expect(service).to have_received(:call).with(@query)
@@ -38,7 +38,7 @@ describe SearchService do
it 'includes the account in the results' do
account = Account.new
service = double(call: account)
allow(FetchRemoteResourceService).to receive(:new).and_return(service)
allow(ResolveURLService).to receive(:new).and_return(service)
results = subject.call(@query, 10)
expect(service).to have_received(:call).with(@query)
@@ -50,7 +50,7 @@ describe SearchService do
it 'includes the status in the results' do
status = Status.new
service = double(call: status)
allow(FetchRemoteResourceService).to receive(:new).and_return(service)
allow(ResolveURLService).to receive(:new).and_return(service)
results = subject.call(@query, 10)
expect(service).to have_received(:call).with(@query)