about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-05-03 17:23:44 -0500
committerDavid Yip <yipdw@member.fsf.org>2018-05-03 17:23:44 -0500
commitc816701550d7cdb593371dc47d0b9430c78308b0 (patch)
treecc4417d14de20e69fd5f9a58d66f84af4a623329 /spec/services
parent3a47842223ff93d8c057f804809f1b111dfd6f76 (diff)
parenta7e71bbd08e089938fbf20ddef5768c2f3ee0702 (diff)
Merge remote-tracking branch 'origin/master' into gs-master
  Conflicts:
 	.travis.yml
 	Gemfile.lock
 	README.md
 	app/controllers/settings/follower_domains_controller.rb
 	app/controllers/statuses_controller.rb
 	app/javascript/mastodon/locales/ja.json
 	app/lib/feed_manager.rb
 	app/models/media_attachment.rb
 	app/models/mute.rb
 	app/models/status.rb
 	app/services/mute_service.rb
 	app/views/home/index.html.haml
 	app/views/stream_entries/_simple_status.html.haml
 	config/locales/ca.yml
 	config/locales/en.yml
 	config/locales/es.yml
 	config/locales/fr.yml
 	config/locales/nl.yml
 	config/locales/pl.yml
 	config/locales/pt-BR.yml
 	config/themes.yml
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/account_search_service_spec.rb21
-rw-r--r--spec/services/activitypub/fetch_remote_account_service_spec.rb2
-rw-r--r--spec/services/activitypub/fetch_remote_status_service_spec.rb2
-rw-r--r--spec/services/activitypub/process_account_service_spec.rb6
-rw-r--r--spec/services/activitypub/process_collection_service_spec.rb2
-rw-r--r--spec/services/after_block_service_spec.rb2
-rw-r--r--spec/services/authorize_follow_service_spec.rb2
-rw-r--r--spec/services/batched_remove_status_service_spec.rb2
-rw-r--r--spec/services/block_domain_from_account_service_spec.rb2
-rw-r--r--spec/services/block_domain_service_spec.rb2
-rw-r--r--spec/services/block_service_spec.rb2
-rw-r--r--spec/services/bootstrap_timeline_service_spec.rb2
-rw-r--r--spec/services/fan_out_on_write_service_spec.rb2
-rw-r--r--spec/services/favourite_service_spec.rb2
-rw-r--r--spec/services/fetch_atom_service_spec.rb2
-rw-r--r--spec/services/fetch_link_card_service_spec.rb2
-rw-r--r--spec/services/fetch_oembed_service_spec.rb125
-rw-r--r--spec/services/fetch_remote_account_service_spec.rb2
-rw-r--r--spec/services/fetch_remote_status_service_spec.rb2
-rw-r--r--spec/services/follow_service_spec.rb2
-rw-r--r--spec/services/mute_service_spec.rb2
-rw-r--r--spec/services/notify_service_spec.rb2
-rw-r--r--spec/services/post_status_service_spec.rb2
-rw-r--r--spec/services/precompute_feed_service_spec.rb2
-rw-r--r--spec/services/process_feed_service_spec.rb2
-rw-r--r--spec/services/process_interaction_service_spec.rb2
-rw-r--r--spec/services/process_mentions_service_spec.rb2
-rw-r--r--spec/services/pubsubhubbub/subscribe_service_spec.rb2
-rw-r--r--spec/services/pubsubhubbub/unsubscribe_service_spec.rb2
-rw-r--r--spec/services/reblog_service_spec.rb2
-rw-r--r--spec/services/reject_follow_service_spec.rb2
-rw-r--r--spec/services/remove_status_service_spec.rb2
-rw-r--r--spec/services/report_service_spec.rb2
-rw-r--r--spec/services/resolve_account_service_spec.rb16
-rw-r--r--spec/services/resolve_url_service_spec.rb2
-rw-r--r--spec/services/search_service_spec.rb2
-rw-r--r--spec/services/send_interaction_service_spec.rb2
-rw-r--r--spec/services/subscribe_service_spec.rb2
-rw-r--r--spec/services/suspend_account_service_spec.rb2
-rw-r--r--spec/services/unblock_domain_service_spec.rb2
-rw-r--r--spec/services/unblock_service_spec.rb2
-rw-r--r--spec/services/unfollow_service_spec.rb2
-rw-r--r--spec/services/unmute_service_spec.rb2
-rw-r--r--spec/services/unsubscribe_service_spec.rb2
-rw-r--r--spec/services/update_remote_profile_service_spec.rb2
45 files changed, 204 insertions, 46 deletions
diff --git a/spec/services/account_search_service_spec.rb b/spec/services/account_search_service_spec.rb
index 9bb27edad..c6cbdcce1 100644
--- a/spec/services/account_search_service_spec.rb
+++ b/spec/services/account_search_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-describe AccountSearchService do
+describe AccountSearchService, type: :service do
   describe '.call' do
     describe 'with a query to ignore' do
       it 'returns empty array for missing query' do
@@ -137,5 +137,24 @@ describe AccountSearchService do
         expect(service).not_to have_received(:call)
       end
     end
+
+    describe 'should not include suspended accounts' do
+      it 'returns the fuzzy match first, and does not return suspended exacts' do
+        partial = Fabricate(:account, username: 'exactness')
+        exact = Fabricate(:account, username: 'exact', suspended: true)
+
+        results = subject.call('exact', 10)
+        expect(results.size).to eq 1
+        expect(results).to eq [partial]
+      end
+
+      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', 2)
+        expect(results.size).to eq 0
+        expect(results).to eq []
+      end
+    end
   end
 end
diff --git a/spec/services/activitypub/fetch_remote_account_service_spec.rb b/spec/services/activitypub/fetch_remote_account_service_spec.rb
index c50d3fb97..dba55c034 100644
--- a/spec/services/activitypub/fetch_remote_account_service_spec.rb
+++ b/spec/services/activitypub/fetch_remote_account_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe ActivityPub::FetchRemoteAccountService do
+RSpec.describe ActivityPub::FetchRemoteAccountService, type: :service do
   subject { ActivityPub::FetchRemoteAccountService.new }
 
   let!(:actor) do
diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb
index a533e8413..549eb80fa 100644
--- a/spec/services/activitypub/fetch_remote_status_service_spec.rb
+++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe ActivityPub::FetchRemoteStatusService do
+RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do
   include ActionView::Helpers::TextHelper
 
   let(:sender) { Fabricate(:account) }
diff --git a/spec/services/activitypub/process_account_service_spec.rb b/spec/services/activitypub/process_account_service_spec.rb
index 15e1f4bb2..d3318b2ed 100644
--- a/spec/services/activitypub/process_account_service_spec.rb
+++ b/spec/services/activitypub/process_account_service_spec.rb
@@ -1,14 +1,14 @@
 require 'rails_helper'
 
-RSpec.describe ActivityPub::ProcessAccountService do
+RSpec.describe ActivityPub::ProcessAccountService, type: :service do
   subject { described_class.new }
 
   context 'property values' do
     let(:payload) do
       {
-        id: 'https://foo',
+        id: 'https://foo.test',
         type: 'Actor',
-        inbox: 'https://foo/inbox',
+        inbox: 'https://foo.test/inbox',
         attachment: [
           { type: 'PropertyValue', name: 'Pronouns', value: 'They/them' },
           { type: 'PropertyValue', name: 'Occupation', value: 'Unit test' },
diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb
index 3cea970cf..e46f0ae45 100644
--- a/spec/services/activitypub/process_collection_service_spec.rb
+++ b/spec/services/activitypub/process_collection_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe ActivityPub::ProcessCollectionService do
+RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
   let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account') }
 
   let(:payload) do
diff --git a/spec/services/after_block_service_spec.rb b/spec/services/after_block_service_spec.rb
index 1b115c938..f63b2045a 100644
--- a/spec/services/after_block_service_spec.rb
+++ b/spec/services/after_block_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe AfterBlockService do
+RSpec.describe AfterBlockService, type: :service do
   subject do
     -> { described_class.new.call(account, target_account) }
   end
diff --git a/spec/services/authorize_follow_service_spec.rb b/spec/services/authorize_follow_service_spec.rb
index 6ea4d83da..562ef0041 100644
--- a/spec/services/authorize_follow_service_spec.rb
+++ b/spec/services/authorize_follow_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe AuthorizeFollowService do
+RSpec.describe AuthorizeFollowService, type: :service do
   let(:sender) { Fabricate(:account, username: 'alice') }
 
   subject { AuthorizeFollowService.new }
diff --git a/spec/services/batched_remove_status_service_spec.rb b/spec/services/batched_remove_status_service_spec.rb
index 437da2a9d..23c122e59 100644
--- a/spec/services/batched_remove_status_service_spec.rb
+++ b/spec/services/batched_remove_status_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe BatchedRemoveStatusService do
+RSpec.describe BatchedRemoveStatusService, type: :service do
   subject { BatchedRemoveStatusService.new }
 
   let!(:alice)  { Fabricate(:account) }
diff --git a/spec/services/block_domain_from_account_service_spec.rb b/spec/services/block_domain_from_account_service_spec.rb
index e7ee34372..365c0a4ad 100644
--- a/spec/services/block_domain_from_account_service_spec.rb
+++ b/spec/services/block_domain_from_account_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe BlockDomainFromAccountService do
+RSpec.describe BlockDomainFromAccountService, type: :service do
   let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org') }
   let!(:alice) { Fabricate(:account, username: 'alice') }
 
diff --git a/spec/services/block_domain_service_spec.rb b/spec/services/block_domain_service_spec.rb
index 5c2cfc8c7..7ef9e2770 100644
--- a/spec/services/block_domain_service_spec.rb
+++ b/spec/services/block_domain_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe BlockDomainService do
+RSpec.describe BlockDomainService, type: :service do
   let(:bad_account) { Fabricate(:account, username: 'badguy666', domain: 'evil.org') }
   let(:bad_status1) { Fabricate(:status, account: bad_account, text: 'You suck') }
   let(:bad_status2) { Fabricate(:status, account: bad_account, text: 'Hahaha') }
diff --git a/spec/services/block_service_spec.rb b/spec/services/block_service_spec.rb
index c69ff7804..6584bb90e 100644
--- a/spec/services/block_service_spec.rb
+++ b/spec/services/block_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe BlockService do
+RSpec.describe BlockService, type: :service do
   let(:sender) { Fabricate(:account, username: 'alice') }
 
   subject { BlockService.new }
diff --git a/spec/services/bootstrap_timeline_service_spec.rb b/spec/services/bootstrap_timeline_service_spec.rb
index 5189b1de8..a765de791 100644
--- a/spec/services/bootstrap_timeline_service_spec.rb
+++ b/spec/services/bootstrap_timeline_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe BootstrapTimelineService do
+RSpec.describe BootstrapTimelineService, type: :service do
   subject { described_class.new }
 
   describe '#call' do
diff --git a/spec/services/fan_out_on_write_service_spec.rb b/spec/services/fan_out_on_write_service_spec.rb
index 764318e34..b7fc7f7ed 100644
--- a/spec/services/fan_out_on_write_service_spec.rb
+++ b/spec/services/fan_out_on_write_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe FanOutOnWriteService do
+RSpec.describe FanOutOnWriteService, type: :service do
   let(:author)   { Fabricate(:account, username: 'tom') }
   let(:status)   { Fabricate(:status, text: 'Hello @alice #test', account: author) }
   let(:alice)    { Fabricate(:user, account: Fabricate(:account, username: 'alice')).account }
diff --git a/spec/services/favourite_service_spec.rb b/spec/services/favourite_service_spec.rb
index 5bf2c74a9..0a20ccf6e 100644
--- a/spec/services/favourite_service_spec.rb
+++ b/spec/services/favourite_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe FavouriteService do
+RSpec.describe FavouriteService, type: :service do
   let(:sender) { Fabricate(:account, username: 'alice') }
 
   subject { FavouriteService.new }
diff --git a/spec/services/fetch_atom_service_spec.rb b/spec/services/fetch_atom_service_spec.rb
index 2bd127e92..bb233c12d 100644
--- a/spec/services/fetch_atom_service_spec.rb
+++ b/spec/services/fetch_atom_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe FetchAtomService do
+RSpec.describe FetchAtomService, type: :service do
   describe '#call' do
     let(:url) { 'http://example.com' }
     subject { FetchAtomService.new.call(url) }
diff --git a/spec/services/fetch_link_card_service_spec.rb b/spec/services/fetch_link_card_service_spec.rb
index edacc4425..88c5339db 100644
--- a/spec/services/fetch_link_card_service_spec.rb
+++ b/spec/services/fetch_link_card_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe FetchLinkCardService do
+RSpec.describe FetchLinkCardService, type: :service do
   subject { FetchLinkCardService.new }
 
   before do
diff --git a/spec/services/fetch_oembed_service_spec.rb b/spec/services/fetch_oembed_service_spec.rb
new file mode 100644
index 000000000..706eb3f2a
--- /dev/null
+++ b/spec/services/fetch_oembed_service_spec.rb
@@ -0,0 +1,125 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+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)
+  end
+
+  describe 'discover_provider' do
+    context 'when status code is 200 and MIME type is text/html' do
+      context 'Both of JSON and XML provider are discoverable' do
+        before do
+          stub_request(:get, 'https://host.test/oembed.html').to_return(
+            status: 200,
+            headers: { 'Content-Type': 'text/html' },
+            body: request_fixture('oembed_json_xml.html')
+          )
+        end
+
+        it 'returns new OEmbed::Provider for JSON provider if :format option is set to :json' do
+          subject.call('https://host.test/oembed.html', format: :json)
+          expect(subject.endpoint_url).to eq 'https://host.test/provider.json'
+          expect(subject.format).to eq :json
+        end
+
+        it 'returns new OEmbed::Provider for XML provider if :format option is set to :xml' do
+          subject.call('https://host.test/oembed.html', format: :xml)
+          expect(subject.endpoint_url).to eq 'https://host.test/provider.xml'
+          expect(subject.format).to eq :xml
+        end
+      end
+
+      context 'JSON provider is discoverable while XML provider is not' do
+        before do
+          stub_request(:get, 'https://host.test/oembed.html').to_return(
+            status: 200,
+            headers: { 'Content-Type': 'text/html' },
+            body: request_fixture('oembed_json.html')
+          )
+        end
+
+        it 'returns new OEmbed::Provider for JSON provider' do
+          subject.call('https://host.test/oembed.html')
+          expect(subject.endpoint_url).to eq 'https://host.test/provider.json'
+          expect(subject.format).to eq :json
+        end
+      end
+
+      context 'XML provider is discoverable while JSON provider is not' do
+        before do
+          stub_request(:get, 'https://host.test/oembed.html').to_return(
+            status: 200,
+            headers: { 'Content-Type': 'text/html' },
+            body: request_fixture('oembed_xml.html')
+          )
+        end
+
+        it 'returns new OEmbed::Provider for XML provider' do
+          subject.call('https://host.test/oembed.html')
+          expect(subject.endpoint_url).to eq 'https://host.test/provider.xml'
+          expect(subject.format).to eq :xml
+        end
+      end
+
+      context '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,
+            headers: { 'Content-Type': 'text/html' },
+            body: request_fixture('oembed_invalid_xml.html')
+          )
+        end
+
+        it 'returns nil' do
+          expect(subject.call('https://host.test/oembed.html')).to be_nil
+        end
+      end
+
+      context 'Neither of JSON and XML provider is discoverable' do
+        before do
+          stub_request(:get, 'https://host.test/oembed.html').to_return(
+            status: 200,
+            headers: { 'Content-Type': 'text/html' },
+            body: request_fixture('oembed_undiscoverable.html')
+          )
+        end
+
+        it 'returns nil' do
+          expect(subject.call('https://host.test/oembed.html')).to be_nil
+        end
+      end
+    end
+
+    context 'when status code is not 200' do
+      before do
+        stub_request(:get, 'https://host.test/oembed.html').to_return(
+          status: 400,
+          headers: { 'Content-Type': 'text/html' },
+          body: request_fixture('oembed_xml.html')
+        )
+      end
+
+      it 'returns nil' do
+        expect(subject.call('https://host.test/oembed.html')).to be_nil
+      end
+    end
+
+    context 'when MIME type is not text/html' do
+      before do
+        stub_request(:get, 'https://host.test/oembed.html').to_return(
+          status: 200,
+          body: request_fixture('oembed_xml.html')
+        )
+      end
+
+      it 'returns nil' do
+        expect(subject.call('https://host.test/oembed.html')).to be_nil
+      end
+    end
+  end
+end
diff --git a/spec/services/fetch_remote_account_service_spec.rb b/spec/services/fetch_remote_account_service_spec.rb
index 4388d4cf4..1c3abe8f3 100644
--- a/spec/services/fetch_remote_account_service_spec.rb
+++ b/spec/services/fetch_remote_account_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe FetchRemoteAccountService do
+RSpec.describe FetchRemoteAccountService, type: :service do
   let(:url) { 'https://example.com' }
   let(:prefetched_body) { nil }
   let(:protocol) { :ostatus }
diff --git a/spec/services/fetch_remote_status_service_spec.rb b/spec/services/fetch_remote_status_service_spec.rb
index fa5782b94..0df9c329a 100644
--- a/spec/services/fetch_remote_status_service_spec.rb
+++ b/spec/services/fetch_remote_status_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe FetchRemoteStatusService do
+RSpec.describe FetchRemoteStatusService, type: :service do
   let(:account) { Fabricate(:account) }
   let(:prefetched_body) { nil }
   let(:valid_domain) { Rails.configuration.x.local_domain }
diff --git a/spec/services/follow_service_spec.rb b/spec/services/follow_service_spec.rb
index e59a2f1a6..3c4ec59be 100644
--- a/spec/services/follow_service_spec.rb
+++ b/spec/services/follow_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe FollowService do
+RSpec.describe FollowService, type: :service do
   let(:sender) { Fabricate(:account, username: 'alice') }
 
   subject { FollowService.new }
diff --git a/spec/services/mute_service_spec.rb b/spec/services/mute_service_spec.rb
index 2b3e3e152..4bb839b8d 100644
--- a/spec/services/mute_service_spec.rb
+++ b/spec/services/mute_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe MuteService do
+RSpec.describe MuteService, type: :service do
   subject do
     -> { described_class.new.call(account, target_account) }
   end
diff --git a/spec/services/notify_service_spec.rb b/spec/services/notify_service_spec.rb
index 1435ec917..ff64eccbe 100644
--- a/spec/services/notify_service_spec.rb
+++ b/spec/services/notify_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe NotifyService do
+RSpec.describe NotifyService, type: :service do
   subject do
     -> { described_class.new.call(recipient, activity) }
   end
diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb
index 92fbc73cd..40fa8fbef 100644
--- a/spec/services/post_status_service_spec.rb
+++ b/spec/services/post_status_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe PostStatusService do
+RSpec.describe PostStatusService, type: :service do
   subject { PostStatusService.new }
 
   it 'creates a new status' do
diff --git a/spec/services/precompute_feed_service_spec.rb b/spec/services/precompute_feed_service_spec.rb
index 43340bffc..1f6b6ed88 100644
--- a/spec/services/precompute_feed_service_spec.rb
+++ b/spec/services/precompute_feed_service_spec.rb
@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-RSpec.describe PrecomputeFeedService do
+RSpec.describe PrecomputeFeedService, type: :service do
   subject { PrecomputeFeedService.new }
 
   describe 'call' do
diff --git a/spec/services/process_feed_service_spec.rb b/spec/services/process_feed_service_spec.rb
index aca675dc6..d8b065063 100644
--- a/spec/services/process_feed_service_spec.rb
+++ b/spec/services/process_feed_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe ProcessFeedService do
+RSpec.describe ProcessFeedService, type: :service do
   subject { ProcessFeedService.new }
 
   describe 'processing a feed' do
diff --git a/spec/services/process_interaction_service_spec.rb b/spec/services/process_interaction_service_spec.rb
index 3ea7aec59..b858c19d0 100644
--- a/spec/services/process_interaction_service_spec.rb
+++ b/spec/services/process_interaction_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe ProcessInteractionService do
+RSpec.describe ProcessInteractionService, type: :service do
   let(:receiver) { Fabricate(:user, email: 'alice@example.com', account: Fabricate(:account, username: 'alice')).account }
   let(:sender)   { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
   let(:remote_sender) { Fabricate(:account, username: 'carol', domain: 'localdomain.com', uri: 'https://webdomain.com/users/carol') }
diff --git a/spec/services/process_mentions_service_spec.rb b/spec/services/process_mentions_service_spec.rb
index 19a8678f0..963924fa9 100644
--- a/spec/services/process_mentions_service_spec.rb
+++ b/spec/services/process_mentions_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe ProcessMentionsService do
+RSpec.describe ProcessMentionsService, type: :service do
   let(:account) { Fabricate(:account, username: 'alice') }
   let(:status)  { Fabricate(:status, account: account, text: "Hello @#{remote_user.acct}") }
 
diff --git a/spec/services/pubsubhubbub/subscribe_service_spec.rb b/spec/services/pubsubhubbub/subscribe_service_spec.rb
index 82094117b..01c956230 100644
--- a/spec/services/pubsubhubbub/subscribe_service_spec.rb
+++ b/spec/services/pubsubhubbub/subscribe_service_spec.rb
@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-describe Pubsubhubbub::SubscribeService do
+describe Pubsubhubbub::SubscribeService, type: :service do
   describe '#call' do
     subject { described_class.new }
     let(:user_account) { Fabricate(:account) }
diff --git a/spec/services/pubsubhubbub/unsubscribe_service_spec.rb b/spec/services/pubsubhubbub/unsubscribe_service_spec.rb
index 59054ed99..7ed9fc5af 100644
--- a/spec/services/pubsubhubbub/unsubscribe_service_spec.rb
+++ b/spec/services/pubsubhubbub/unsubscribe_service_spec.rb
@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-describe Pubsubhubbub::UnsubscribeService do
+describe Pubsubhubbub::UnsubscribeService, type: :service do
   describe '#call' do
     subject { described_class.new }
 
diff --git a/spec/services/reblog_service_spec.rb b/spec/services/reblog_service_spec.rb
index 19d3bb6cb..2755da772 100644
--- a/spec/services/reblog_service_spec.rb
+++ b/spec/services/reblog_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe ReblogService do
+RSpec.describe ReblogService, type: :service do
   let(:alice)  { Fabricate(:account, username: 'alice') }
 
   context 'OStatus' do
diff --git a/spec/services/reject_follow_service_spec.rb b/spec/services/reject_follow_service_spec.rb
index bf49dd2c9..e5ac37ed9 100644
--- a/spec/services/reject_follow_service_spec.rb
+++ b/spec/services/reject_follow_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe RejectFollowService do
+RSpec.describe RejectFollowService, type: :service do
   let(:sender) { Fabricate(:account, username: 'alice') }
 
   subject { RejectFollowService.new }
diff --git a/spec/services/remove_status_service_spec.rb b/spec/services/remove_status_service_spec.rb
index 5bb75b820..2134f51fd 100644
--- a/spec/services/remove_status_service_spec.rb
+++ b/spec/services/remove_status_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe RemoveStatusService do
+RSpec.describe RemoveStatusService, type: :service do
   subject { RemoveStatusService.new }
 
   let!(:alice)  { Fabricate(:account) }
diff --git a/spec/services/report_service_spec.rb b/spec/services/report_service_spec.rb
index 2f926ef00..2c392d376 100644
--- a/spec/services/report_service_spec.rb
+++ b/spec/services/report_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe ReportService do
+RSpec.describe ReportService, type: :service do
   subject { described_class.new }
 
   let(:source_account) { Fabricate(:account) }
diff --git a/spec/services/resolve_account_service_spec.rb b/spec/services/resolve_account_service_spec.rb
index 5f1b4467b..f4c810f75 100644
--- a/spec/services/resolve_account_service_spec.rb
+++ b/spec/services/resolve_account_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe ResolveAccountService do
+RSpec.describe ResolveAccountService, type: :service do
   subject { described_class.new }
 
   before do
@@ -105,6 +105,20 @@ RSpec.describe ResolveAccountService do
       expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
     end
 
+    context 'with multiple types' do
+      before do
+        stub_request(:get, "https://ap.example.com/users/foo").to_return(request_fixture('activitypub-actor-individual.txt'))
+      end
+
+      it 'returns new remote account' do
+        account = subject.call('foo@ap.example.com')
+
+        expect(account.activitypub?).to eq true
+        expect(account.domain).to eq 'ap.example.com'
+        expect(account.inbox_url).to eq 'https://ap.example.com/users/foo/inbox'
+      end
+    end
+
     pending
   end
 
diff --git a/spec/services/resolve_url_service_spec.rb b/spec/services/resolve_url_service_spec.rb
index 1e9be4c07..7bb5d1940 100644
--- a/spec/services/resolve_url_service_spec.rb
+++ b/spec/services/resolve_url_service_spec.rb
@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-describe ResolveURLService do
+describe ResolveURLService, type: :service do
   subject { described_class.new }
 
   describe '#call' do
diff --git a/spec/services/search_service_spec.rb b/spec/services/search_service_spec.rb
index 957b60c7d..673de5233 100644
--- a/spec/services/search_service_spec.rb
+++ b/spec/services/search_service_spec.rb
@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-describe SearchService do
+describe SearchService, type: :service do
   subject { described_class.new }
 
   describe '#call' do
diff --git a/spec/services/send_interaction_service_spec.rb b/spec/services/send_interaction_service_spec.rb
index ff08394b0..710d8184c 100644
--- a/spec/services/send_interaction_service_spec.rb
+++ b/spec/services/send_interaction_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe SendInteractionService do
+RSpec.describe SendInteractionService, type: :service do
   subject { SendInteractionService.new }
 
   it 'sends an XML envelope to the Salmon end point of remote user'
diff --git a/spec/services/subscribe_service_spec.rb b/spec/services/subscribe_service_spec.rb
index 835be5ec5..10bdb1ba8 100644
--- a/spec/services/subscribe_service_spec.rb
+++ b/spec/services/subscribe_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe SubscribeService do
+RSpec.describe SubscribeService, type: :service do
   let(:account) { Fabricate(:account, username: 'bob', domain: 'example.com', hub_url: 'http://hub.example.com') }
   subject { SubscribeService.new }
 
diff --git a/spec/services/suspend_account_service_spec.rb b/spec/services/suspend_account_service_spec.rb
index 1cb647e8d..fd303a9d5 100644
--- a/spec/services/suspend_account_service_spec.rb
+++ b/spec/services/suspend_account_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe SuspendAccountService do
+RSpec.describe SuspendAccountService, type: :service do
   describe '#call' do
     subject do
       -> { described_class.new.call(account) }
diff --git a/spec/services/unblock_domain_service_spec.rb b/spec/services/unblock_domain_service_spec.rb
index c32e5d655..8e8893d63 100644
--- a/spec/services/unblock_domain_service_spec.rb
+++ b/spec/services/unblock_domain_service_spec.rb
@@ -2,7 +2,7 @@
 
 require 'rails_helper'
 
-describe UnblockDomainService do
+describe UnblockDomainService, type: :service do
   subject { described_class.new }
 
   describe 'call' do
diff --git a/spec/services/unblock_service_spec.rb b/spec/services/unblock_service_spec.rb
index ca7a6b77e..5835b912b 100644
--- a/spec/services/unblock_service_spec.rb
+++ b/spec/services/unblock_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe UnblockService do
+RSpec.describe UnblockService, type: :service do
   let(:sender) { Fabricate(:account, username: 'alice') }
 
   subject { UnblockService.new }
diff --git a/spec/services/unfollow_service_spec.rb b/spec/services/unfollow_service_spec.rb
index 021e76782..c5914c818 100644
--- a/spec/services/unfollow_service_spec.rb
+++ b/spec/services/unfollow_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe UnfollowService do
+RSpec.describe UnfollowService, type: :service do
   let(:sender) { Fabricate(:account, username: 'alice') }
 
   subject { UnfollowService.new }
diff --git a/spec/services/unmute_service_spec.rb b/spec/services/unmute_service_spec.rb
index 5dc971fb1..8463eb283 100644
--- a/spec/services/unmute_service_spec.rb
+++ b/spec/services/unmute_service_spec.rb
@@ -1,5 +1,5 @@
 require 'rails_helper'
 
-RSpec.describe UnmuteService do
+RSpec.describe UnmuteService, type: :service do
   subject { UnmuteService.new }
 end
diff --git a/spec/services/unsubscribe_service_spec.rb b/spec/services/unsubscribe_service_spec.rb
index 2a02f4c75..54d4b1b53 100644
--- a/spec/services/unsubscribe_service_spec.rb
+++ b/spec/services/unsubscribe_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe UnsubscribeService do
+RSpec.describe UnsubscribeService, type: :service do
   let(:account) { Fabricate(:account, username: 'bob', domain: 'example.com', hub_url: 'http://hub.example.com') }
   subject { UnsubscribeService.new }
 
diff --git a/spec/services/update_remote_profile_service_spec.rb b/spec/services/update_remote_profile_service_spec.rb
index 64ec2dbbb..7ac3a809a 100644
--- a/spec/services/update_remote_profile_service_spec.rb
+++ b/spec/services/update_remote_profile_service_spec.rb
@@ -1,6 +1,6 @@
 require 'rails_helper'
 
-RSpec.describe UpdateRemoteProfileService do
+RSpec.describe UpdateRemoteProfileService, type: :service do
   let(:xml) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'push', 'feed.atom')) }
 
   subject { UpdateRemoteProfileService.new }