about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorpluralcafe-docker <git@plural.cafe>2018-10-13 01:09:02 +0000
committerpluralcafe-docker <git@plural.cafe>2018-10-13 01:09:02 +0000
commit7c96ee7815c216d6ac3b748d7dd6959376d3914e (patch)
treefd36bade02afa1536198e7f3beafb208973b68c5 /spec
parentf9275cb762a311cbf298b3929552a153703c0726 (diff)
parent70d346ea951ebfa002225759310d72882a435a5c (diff)
Merge branch 'glitch'
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/accounts_controller_spec.rb4
-rw-r--r--spec/controllers/admin/accounts_controller_spec.rb5
-rw-r--r--spec/controllers/admin/email_domain_blocks_controller_spec.rb4
-rw-r--r--spec/controllers/admin/invites_controller_spec.rb2
-rw-r--r--spec/controllers/admin/report_notes_controller_spec.rb11
-rw-r--r--spec/controllers/admin/reported_statuses_controller_spec.rb2
-rw-r--r--spec/controllers/admin/statuses_controller_spec.rb2
-rw-r--r--spec/controllers/api/salmon_controller_spec.rb4
-rw-r--r--spec/controllers/api/subscriptions_controller_spec.rb2
-rw-r--r--spec/controllers/api/v1/accounts_controller_spec.rb4
-rw-r--r--spec/controllers/api/v1/conversations_controller_spec.rb37
-rw-r--r--spec/controllers/api/v1/favourites_controller_spec.rb2
-rw-r--r--spec/controllers/api/v1/reports_controller_spec.rb10
-rw-r--r--spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb1
-rw-r--r--spec/controllers/api/v1/streaming_controller_spec.rb3
-rw-r--r--spec/controllers/api/v1/timelines/home_controller_spec.rb2
-rw-r--r--spec/controllers/api/v1/timelines/public_controller_spec.rb2
-rw-r--r--spec/controllers/api/web/embeds_controller_spec.rb2
-rw-r--r--spec/controllers/application_controller_spec.rb2
-rw-r--r--spec/controllers/auth/confirmations_controller_spec.rb2
-rw-r--r--spec/controllers/concerns/export_controller_concern_spec.rb1
-rw-r--r--spec/controllers/concerns/signature_verification_spec.rb24
-rw-r--r--spec/controllers/invites_controller_spec.rb2
-rw-r--r--spec/controllers/remote_unfollows_controller_spec.rb6
-rw-r--r--spec/controllers/settings/applications_controller_spec.rb65
-rw-r--r--spec/controllers/settings/migrations_controller_spec.rb2
-rw-r--r--spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb2
-rw-r--r--spec/fabricators/account_fabricator.rb2
-rw-r--r--spec/fabricators/conversation_account_fabricator.rb6
-rw-r--r--spec/fabricators/list_fabricator.rb2
-rw-r--r--spec/fabricators/relay_fabricator.rb2
-rw-r--r--spec/fabricators/site_upload_fabricator.rb1
-rw-r--r--spec/fabricators/user_fabricator.rb2
-rw-r--r--spec/features/log_in_spec.rb2
-rw-r--r--spec/helpers/application_helper_spec.rb8
-rw-r--r--spec/lib/feed_manager_spec.rb2
-rw-r--r--spec/lib/formatter_spec.rb13
-rw-r--r--spec/lib/language_detector_spec.rb12
-rw-r--r--spec/lib/ostatus/atom_serializer_spec.rb26
-rw-r--r--spec/lib/request_spec.rb2
-rw-r--r--spec/models/account_conversation_spec.rb72
-rw-r--r--spec/models/account_filter_spec.rb6
-rw-r--r--spec/models/account_moderation_note_spec.rb1
-rw-r--r--spec/models/account_spec.rb2
-rw-r--r--spec/models/admin/action_log_spec.rb1
-rw-r--r--spec/models/backup_spec.rb1
-rw-r--r--spec/models/conversation_mute_spec.rb1
-rw-r--r--spec/models/custom_emoji_spec.rb2
-rw-r--r--spec/models/custom_filter_spec.rb1
-rw-r--r--spec/models/follow_spec.rb14
-rw-r--r--spec/models/list_account_spec.rb1
-rw-r--r--spec/models/list_spec.rb1
-rw-r--r--spec/models/media_attachment_spec.rb2
-rw-r--r--spec/models/mute_spec.rb1
-rw-r--r--spec/models/preview_card_spec.rb1
-rw-r--r--spec/models/remote_follow_spec.rb4
-rw-r--r--spec/models/status_spec.rb2
-rw-r--r--spec/models/user_spec.rb4
-rw-r--r--spec/models/web/setting_spec.rb1
-rw-r--r--spec/rails_helper.rb4
-rw-r--r--spec/services/activitypub/process_collection_service_spec.rb4
-rw-r--r--spec/services/batched_remove_status_service_spec.rb2
-rw-r--r--spec/services/fetch_atom_service_spec.rb2
-rw-r--r--spec/services/fetch_remote_account_service_spec.rb2
-rw-r--r--spec/services/process_feed_service_spec.rb2
-rw-r--r--spec/services/update_remote_profile_service_spec.rb2
-rw-r--r--spec/services/verify_link_service_spec.rb139
-rw-r--r--spec/views/about/show.html.haml_spec.rb1
-rw-r--r--spec/views/stream_entries/show.html.haml_spec.rb4
69 files changed, 368 insertions, 197 deletions
diff --git a/spec/controllers/accounts_controller_spec.rb b/spec/controllers/accounts_controller_spec.rb
index 18c249c07..3ba5d8aec 100644
--- a/spec/controllers/accounts_controller_spec.rb
+++ b/spec/controllers/accounts_controller_spec.rb
@@ -3,8 +3,8 @@ require 'rails_helper'
 RSpec.describe AccountsController, type: :controller do
   render_views
 
-  let(:alice)  { Fabricate(:account, username: 'alice') }
-  let(:eve)  { Fabricate(:user) }
+  let(:alice) { Fabricate(:account, username: 'alice') }
+  let(:eve) { Fabricate(:user) }
 
   describe 'GET #show' do
     let!(:status1) { Status.create!(account: alice, text: 'Hello world') }
diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb
index 197e019fe..ae9e058c8 100644
--- a/spec/controllers/admin/accounts_controller_spec.rb
+++ b/spec/controllers/admin/accounts_controller_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
         expect(h[:remote]).to eq '1'
         expect(h[:by_domain]).to eq 'domain'
         expect(h[:silenced]).to eq '1'
-        expect(h[:recent]).to eq '1'
+        expect(h[:alphabetic]).to eq '1'
         expect(h[:suspended]).to eq '1'
         expect(h[:username]).to eq 'username'
         expect(h[:display_name]).to eq 'display name'
@@ -40,7 +40,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
         remote: '1',
         by_domain: 'domain',
         silenced: '1',
-        recent: '1',
+        alphabetic: '1',
         suspended: '1',
         username: 'username',
         display_name: 'display name',
@@ -75,7 +75,6 @@ RSpec.describe Admin::AccountsController, type: :controller do
     end
   end
 
-
   describe 'POST #subscribe' do
     subject { post :subscribe, params: { id: account.id } }
 
diff --git a/spec/controllers/admin/email_domain_blocks_controller_spec.rb b/spec/controllers/admin/email_domain_blocks_controller_spec.rb
index 133d38ff1..52db56f4e 100644
--- a/spec/controllers/admin/email_domain_blocks_controller_spec.rb
+++ b/spec/controllers/admin/email_domain_blocks_controller_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe Admin::EmailDomainBlocksController, type: :controller do
 
   describe 'POST #create' do
     it 'blocks the domain when succeeded to save' do
-      post :create, params: { email_domain_block: { domain: 'example.com'} }
+      post :create, params: { email_domain_block: { domain: 'example.com' } }
 
       expect(flash[:notice]).to eq I18n.t('admin.email_domain_blocks.created_msg')
       expect(response).to redirect_to(admin_email_domain_blocks_path)
@@ -50,7 +50,7 @@ RSpec.describe Admin::EmailDomainBlocksController, type: :controller do
   describe 'DELETE #destroy' do
     it 'unblocks the domain' do
       email_domain_block = Fabricate(:email_domain_block)
-      delete :destroy, params: { id: email_domain_block.id } 
+      delete :destroy, params: { id: email_domain_block.id }
 
       expect(flash[:notice]).to eq I18n.t('admin.email_domain_blocks.destroyed_msg')
       expect(response).to redirect_to(admin_email_domain_blocks_path)
diff --git a/spec/controllers/admin/invites_controller_spec.rb b/spec/controllers/admin/invites_controller_spec.rb
index e7d995411..34b51a6aa 100644
--- a/spec/controllers/admin/invites_controller_spec.rb
+++ b/spec/controllers/admin/invites_controller_spec.rb
@@ -24,7 +24,7 @@ describe Admin::InvitesController do
     subject { post :create, params: { invite: { max_uses: '10', expires_in: 1800 } } }
 
     it 'succeeds to create a invite' do
-      expect{ subject }.to change { Invite.count }.by(1)
+      expect { subject }.to change { Invite.count }.by(1)
       expect(subject).to redirect_to admin_invites_path
       expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10)
     end
diff --git a/spec/controllers/admin/report_notes_controller_spec.rb b/spec/controllers/admin/report_notes_controller_spec.rb
index 2c32303fb..ec5872c7d 100644
--- a/spec/controllers/admin/report_notes_controller_spec.rb
+++ b/spec/controllers/admin/report_notes_controller_spec.rb
@@ -15,7 +15,6 @@ describe Admin::ReportNotesController do
     let(:report) { Fabricate(:report, action_taken: action_taken, action_taken_by_account_id: account_id) }
 
     context 'when parameter is valid' do
-
       context 'when report is unsolved' do
         let(:action_taken) { false }
         let(:account_id) { nil }
@@ -24,7 +23,7 @@ describe Admin::ReportNotesController do
           let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_resolve: nil } }
 
           it 'creates a report note and resolves report' do
-            expect{ subject }.to change{ ReportNote.count }.by(1)
+            expect { subject }.to change { ReportNote.count }.by(1)
             expect(report.reload).to be_action_taken
             expect(subject).to redirect_to admin_reports_path
           end
@@ -34,7 +33,7 @@ describe Admin::ReportNotesController do
           let(:params) { { report_note: { content: 'test content', report_id: report.id } } }
 
           it 'creates a report note and does not resolve report' do
-            expect{ subject }.to change{ ReportNote.count }.by(1)
+            expect { subject }.to change { ReportNote.count }.by(1)
             expect(report.reload).not_to be_action_taken
             expect(subject).to redirect_to admin_report_path(report)
           end
@@ -49,7 +48,7 @@ describe Admin::ReportNotesController do
           let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_unresolve: nil } }
 
           it 'creates a report note and unresolves report' do
-            expect{ subject }.to change{ ReportNote.count }.by(1)
+            expect { subject }.to change { ReportNote.count }.by(1)
             expect(report.reload).not_to be_action_taken
             expect(subject).to redirect_to admin_report_path(report)
           end
@@ -59,7 +58,7 @@ describe Admin::ReportNotesController do
           let(:params) { { report_note: { content: 'test content', report_id: report.id } } }
 
           it 'creates a report note and does not unresolve report' do
-            expect{ subject }.to change{ ReportNote.count }.by(1)
+            expect { subject }.to change { ReportNote.count }.by(1)
             expect(report.reload).to be_action_taken
             expect(subject).to redirect_to admin_report_path(report)
           end
@@ -84,7 +83,7 @@ describe Admin::ReportNotesController do
     let!(:report_note) { Fabricate(:report_note) }
 
     it 'deletes note' do
-      expect{ subject }.to change{ ReportNote.count }.by(-1)
+      expect { subject }.to change { ReportNote.count }.by(-1)
       expect(subject).to redirect_to admin_report_path(report_note.report)
     end
   end
diff --git a/spec/controllers/admin/reported_statuses_controller_spec.rb b/spec/controllers/admin/reported_statuses_controller_spec.rb
index 7adbf36b9..c358506d6 100644
--- a/spec/controllers/admin/reported_statuses_controller_spec.rb
+++ b/spec/controllers/admin/reported_statuses_controller_spec.rb
@@ -13,7 +13,7 @@ describe Admin::ReportedStatusesController do
 
   describe 'POST #create' do
     subject do
-      -> { post :create, params: { :report_id  => report, action => '', :form_status_batch => { status_ids: status_ids } } }
+      -> { post :create, params: { :report_id => report, action => '', :form_status_batch => { status_ids: status_ids } } }
     end
 
     let(:action) { 'nsfw_on' }
diff --git a/spec/controllers/admin/statuses_controller_spec.rb b/spec/controllers/admin/statuses_controller_spec.rb
index 6afcc1442..1a08c10b7 100644
--- a/spec/controllers/admin/statuses_controller_spec.rb
+++ b/spec/controllers/admin/statuses_controller_spec.rb
@@ -24,7 +24,7 @@ describe Admin::StatusesController do
     end
 
     it 'returns http success with media' do
-      get :index, params: { account_id: account.id , media: true }
+      get :index, params: { account_id: account.id, media: true }
 
       statuses = assigns(:statuses).to_a
       expect(statuses.size).to eq 1
diff --git a/spec/controllers/api/salmon_controller_spec.rb b/spec/controllers/api/salmon_controller_spec.rb
index 8ce4913a5..235a29af0 100644
--- a/spec/controllers/api/salmon_controller_spec.rb
+++ b/spec/controllers/api/salmon_controller_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe Api::SalmonController, type: :controller do
   describe 'POST #update' do
     context 'with valid post data' do
       before do
-        post :update, params: { id: account.id }, body: File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml'))
+        post :update, params: { id: account.id }, body: File.read(Rails.root.join('spec', 'fixtures', 'salmon', 'mention.xml'))
       end
 
       it 'contains XML in the request body' do
@@ -54,7 +54,7 @@ RSpec.describe Api::SalmonController, type: :controller do
         service = double(call: false)
         allow(VerifySalmonService).to receive(:new).and_return(service)
 
-        post :update, params: { id: account.id }, body: File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml'))
+        post :update, params: { id: account.id }, body: File.read(Rails.root.join('spec', 'fixtures', 'salmon', 'mention.xml'))
       end
 
       it 'returns http client error' do
diff --git a/spec/controllers/api/subscriptions_controller_spec.rb b/spec/controllers/api/subscriptions_controller_spec.rb
index b46971a54..7a4252fe6 100644
--- a/spec/controllers/api/subscriptions_controller_spec.rb
+++ b/spec/controllers/api/subscriptions_controller_spec.rb
@@ -33,7 +33,7 @@ RSpec.describe Api::SubscriptionsController, type: :controller do
   end
 
   describe 'POST #update' do
-    let(:feed) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'push', 'feed.atom')) }
+    let(:feed) { File.read(Rails.root.join('spec', 'fixtures', 'push', 'feed.atom')) }
 
     before do
       stub_request(:post, "https://quitter.no/main/push/hub").to_return(:status => 200, :body => "", :headers => {})
diff --git a/spec/controllers/api/v1/accounts_controller_spec.rb b/spec/controllers/api/v1/accounts_controller_spec.rb
index 3e54e88a5..c506fb5f0 100644
--- a/spec/controllers/api/v1/accounts_controller_spec.rb
+++ b/spec/controllers/api/v1/accounts_controller_spec.rb
@@ -154,7 +154,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
 
     before do
       user.account.follow!(other_account)
-      post :mute, params: {id: other_account.id }
+      post :mute, params: { id: other_account.id }
     end
 
     it 'returns http success' do
@@ -182,7 +182,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do
 
     before do
       user.account.follow!(other_account)
-      post :mute, params: {id: other_account.id, notifications: false }
+      post :mute, params: { id: other_account.id, notifications: false }
     end
 
     it 'returns http success' do
diff --git a/spec/controllers/api/v1/conversations_controller_spec.rb b/spec/controllers/api/v1/conversations_controller_spec.rb
new file mode 100644
index 000000000..2e9525855
--- /dev/null
+++ b/spec/controllers/api/v1/conversations_controller_spec.rb
@@ -0,0 +1,37 @@
+require 'rails_helper'
+
+RSpec.describe Api::V1::ConversationsController, type: :controller do
+  render_views
+
+  let!(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
+  let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
+  let(:other) { Fabricate(:user, account: Fabricate(:account, username: 'bob')) }
+
+  before do
+    allow(controller).to receive(:doorkeeper_token) { token }
+  end
+
+  describe 'GET #index' do
+    let(:scopes) { 'read:statuses' }
+
+    before do
+      PostStatusService.new.call(other.account, 'Hey @alice', nil, visibility: 'direct')
+    end
+
+    it 'returns http success' do
+      get :index
+      expect(response).to have_http_status(200)
+    end
+
+    it 'returns pagination headers' do
+      get :index, params: { limit: 1 }
+      expect(response.headers['Link'].links.size).to eq(2)
+    end
+
+    it 'returns conversations' do
+      get :index
+      json = body_as_json
+      expect(json.size).to eq 1
+    end
+  end
+end
diff --git a/spec/controllers/api/v1/favourites_controller_spec.rb b/spec/controllers/api/v1/favourites_controller_spec.rb
index 2bdf927f2..231f76500 100644
--- a/spec/controllers/api/v1/favourites_controller_spec.rb
+++ b/spec/controllers/api/v1/favourites_controller_spec.rb
@@ -64,7 +64,7 @@ RSpec.describe Api::V1::FavouritesController, type: :controller do
           get :index, params: { limit: 1 }
 
           expect(response.headers['Link'].find_link(['rel', 'next']).href).to eq "http://test.host/api/v1/favourites?limit=1&max_id=#{favourite.id}"
-          expect(response.headers['Link'].find_link(['rel', 'prev']).href).to eq "http://test.host/api/v1/favourites?limit=1&since_id=#{favourite.id}"
+          expect(response.headers['Link'].find_link(['rel', 'prev']).href).to eq "http://test.host/api/v1/favourites?limit=1&min_id=#{favourite.id}"
         end
 
         it 'does not add pagination headers if not necessary' do
diff --git a/spec/controllers/api/v1/reports_controller_spec.rb b/spec/controllers/api/v1/reports_controller_spec.rb
index ac93998c6..a3596cf8a 100644
--- a/spec/controllers/api/v1/reports_controller_spec.rb
+++ b/spec/controllers/api/v1/reports_controller_spec.rb
@@ -12,16 +12,6 @@ RSpec.describe Api::V1::ReportsController, type: :controller do
     allow(controller).to receive(:doorkeeper_token) { token }
   end
 
-  describe 'GET #index' do
-    let(:scopes) { 'read:reports' }
-
-    it 'returns http success' do
-      get :index
-
-      expect(response).to have_http_status(200)
-    end
-  end
-
   describe 'POST #create' do
     let(:scopes)  { 'write:reports' }
     let!(:status) { Fabricate(:status) }
diff --git a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb b/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb
index 23b5d7de9..40f75c700 100644
--- a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb
+++ b/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb
@@ -25,7 +25,6 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :control
         expect(response.headers['Link'].links.size).to eq(2)
       end
     end
-
   end
 
   context 'without an oauth token' do
diff --git a/spec/controllers/api/v1/streaming_controller_spec.rb b/spec/controllers/api/v1/streaming_controller_spec.rb
index daf2807e7..4ab409a54 100644
--- a/spec/controllers/api/v1/streaming_controller_spec.rb
+++ b/spec/controllers/api/v1/streaming_controller_spec.rb
@@ -31,7 +31,7 @@ describe Api::V1::StreamingController do
 
     describe 'GET #index' do
       it 'redirects to streaming host' do
-        get :index, params: {access_token: 'deadbeef', stream: 'public'}
+        get :index, params: { access_token: 'deadbeef', stream: 'public' }
         expect(response).to have_http_status(301)
         request_uri = URI.parse(request.url)
         redirect_to_uri = URI.parse(response.location)
@@ -42,5 +42,4 @@ describe Api::V1::StreamingController do
       end
     end
   end
-
 end
diff --git a/spec/controllers/api/v1/timelines/home_controller_spec.rb b/spec/controllers/api/v1/timelines/home_controller_spec.rb
index a667c33fa..63d624c35 100644
--- a/spec/controllers/api/v1/timelines/home_controller_spec.rb
+++ b/spec/controllers/api/v1/timelines/home_controller_spec.rb
@@ -5,7 +5,7 @@ require 'rails_helper'
 describe Api::V1::Timelines::HomeController do
   render_views
 
-  let(:user)  { Fabricate(:user, account: Fabricate(:account, username: 'alice'), current_sign_in_at: 1.day.ago) }
+  let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice'), current_sign_in_at: 1.day.ago) }
 
   before do
     allow(controller).to receive(:doorkeeper_token) { token }
diff --git a/spec/controllers/api/v1/timelines/public_controller_spec.rb b/spec/controllers/api/v1/timelines/public_controller_spec.rb
index 68d87bbcb..a0f778cdc 100644
--- a/spec/controllers/api/v1/timelines/public_controller_spec.rb
+++ b/spec/controllers/api/v1/timelines/public_controller_spec.rb
@@ -5,7 +5,7 @@ require 'rails_helper'
 describe Api::V1::Timelines::PublicController do
   render_views
 
-  let(:user)  { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
+  let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
 
   before do
     allow(controller).to receive(:doorkeeper_token) { token }
diff --git a/spec/controllers/api/web/embeds_controller_spec.rb b/spec/controllers/api/web/embeds_controller_spec.rb
index 6b7297189..a8fc1718f 100644
--- a/spec/controllers/api/web/embeds_controller_spec.rb
+++ b/spec/controllers/api/web/embeds_controller_spec.rb
@@ -14,7 +14,7 @@ describe Api::Web::EmbedsController do
 
     context 'when successfully finds status' do
       let(:status) { Fabricate(:status) }
-      let(:url) { "http://#{ Rails.configuration.x.web_domain }/@#{status.account.username}/#{status.id}" }
+      let(:url) { "http://#{Rails.configuration.x.web_domain}/@#{status.account.username}/#{status.id}" }
 
       it 'returns a right response' do
         expect(response).to have_http_status :ok
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index 2603688be..ea443b80c 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -201,7 +201,7 @@ describe ApplicationController, type: :controller do
   describe 'raise_not_found' do
     it 'raises error' do
       controller.params[:unmatched_route] = 'unmatched'
-      expect{ controller.raise_not_found }.to raise_error(ActionController::RoutingError, 'No route matches unmatched')
+      expect { controller.raise_not_found }.to raise_error(ActionController::RoutingError, 'No route matches unmatched')
     end
   end
 
diff --git a/spec/controllers/auth/confirmations_controller_spec.rb b/spec/controllers/auth/confirmations_controller_spec.rb
index 35eed4f51..e9a471fc5 100644
--- a/spec/controllers/auth/confirmations_controller_spec.rb
+++ b/spec/controllers/auth/confirmations_controller_spec.rb
@@ -67,7 +67,7 @@ describe Auth::ConfirmationsController, type: :controller do
   end
 
   describe 'PATCH #finish_signup' do
-    subject { patch :finish_signup, params: { user: { email: email }} }
+    subject { patch :finish_signup, params: { user: { email: email } } }
 
     let(:user) { Fabricate(:user) }
     before do
diff --git a/spec/controllers/concerns/export_controller_concern_spec.rb b/spec/controllers/concerns/export_controller_concern_spec.rb
index 6a13db69d..e5861c801 100644
--- a/spec/controllers/concerns/export_controller_concern_spec.rb
+++ b/spec/controllers/concerns/export_controller_concern_spec.rb
@@ -8,6 +8,7 @@ describe ApplicationController, type: :controller do
     def index
       send_export_file
     end
+
     def export_data
       @export.account.username
     end
diff --git a/spec/controllers/concerns/signature_verification_spec.rb b/spec/controllers/concerns/signature_verification_spec.rb
index 3daf1fc4e..720690097 100644
--- a/spec/controllers/concerns/signature_verification_spec.rb
+++ b/spec/controllers/concerns/signature_verification_spec.rb
@@ -73,6 +73,30 @@ describe ApplicationController, type: :controller do
       end
     end
 
+    context 'with request older than a day' do
+      before do
+        get :success
+
+        fake_request = Request.new(:get, request.url)
+        fake_request.add_headers({ 'Date' => 2.days.ago.utc.httpdate })
+        fake_request.on_behalf_of(author)
+
+        request.headers.merge!(fake_request.headers)
+      end
+
+      describe '#signed_request?' do
+        it 'returns true' do
+          expect(controller.signed_request?).to be true
+        end
+      end
+
+      describe '#signed_request_account' do
+        it 'returns nil' do
+          expect(controller.signed_request_account).to be_nil
+        end
+      end
+    end
+
     context 'with body' do
       before do
         post :success, body: 'Hello world'
diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb
index 9f5ab67c3..76e617e6b 100644
--- a/spec/controllers/invites_controller_spec.rb
+++ b/spec/controllers/invites_controller_spec.rb
@@ -43,7 +43,7 @@ describe InvitesController do
       let(:user) { Fabricate(:user, moderator: false, admin: true) }
 
       it 'succeeds to create a invite' do
-        expect{ subject }.to change { Invite.count }.by(1)
+        expect { subject }.to change { Invite.count }.by(1)
         expect(subject).to redirect_to invites_path
         expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10)
       end
diff --git a/spec/controllers/remote_unfollows_controller_spec.rb b/spec/controllers/remote_unfollows_controller_spec.rb
index 223ed64af..a1a55ede0 100644
--- a/spec/controllers/remote_unfollows_controller_spec.rb
+++ b/spec/controllers/remote_unfollows_controller_spec.rb
@@ -14,11 +14,11 @@ describe RemoteUnfollowsController do
     before do
       sign_in current_user
       current_account.follow!(remote_account)
-      stub_request(:post, 'http://example.com/inbox'){ { status: 200 } }
+      stub_request(:post, 'http://example.com/inbox') { { status: 200 } }
     end
 
     context 'when successfully unfollow remote account' do
-      let(:acct) {"acct:#{ remote_account.username }@#{ remote_account.domain }"}
+      let(:acct) { "acct:#{remote_account.username}@#{remote_account.domain}" }
 
       it do
         is_expected.to render_template :success
@@ -27,7 +27,7 @@ describe RemoteUnfollowsController do
     end
 
     context 'when fails to unfollow remote account' do
-      let(:acct) {"acct:#{ remote_account.username + '_test' }@#{ remote_account.domain }"}
+      let(:acct) { "acct:#{remote_account.username + '_test'}@#{remote_account.domain}" }
 
       it do
         is_expected.to render_template :error
diff --git a/spec/controllers/settings/applications_controller_spec.rb b/spec/controllers/settings/applications_controller_spec.rb
index f87107695..29c278148 100644
--- a/spec/controllers/settings/applications_controller_spec.rb
+++ b/spec/controllers/settings/applications_controller_spec.rb
@@ -21,7 +21,6 @@ describe Settings::ApplicationsController do
     end
   end
 
-
   describe 'GET #show' do
     it 'returns http success' do
       get :show, params: { id: app.id }
@@ -48,13 +47,13 @@ describe Settings::ApplicationsController do
     context 'success (passed scopes as a String)' do
       def call_create
         post :create, params: {
-               doorkeeper_application: {
-                 name: 'My New App',
-                 redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
-                 website: 'http://google.com',
-                 scopes: 'read write follow'
-               }
-             }
+          doorkeeper_application: {
+            name: 'My New App',
+            redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
+            website: 'http://google.com',
+            scopes: 'read write follow'
+          }
+        }
         response
       end
 
@@ -70,13 +69,13 @@ describe Settings::ApplicationsController do
     context 'success (passed scopes as an Array)' do
       def call_create
         post :create, params: {
-               doorkeeper_application: {
-                 name: 'My New App',
-                 redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
-                 website: 'http://google.com',
-                 scopes: [ 'read', 'write', 'follow' ]
-               }
-             }
+          doorkeeper_application: {
+            name: 'My New App',
+            redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
+            website: 'http://google.com',
+            scopes: [ 'read', 'write', 'follow' ]
+          }
+        }
         response
       end
 
@@ -92,13 +91,13 @@ describe Settings::ApplicationsController do
     context 'failure' do
       before do
         post :create, params: {
-               doorkeeper_application: {
-                 name: '',
-                 redirect_uri: '',
-                 website: '',
-                 scopes: []
-               }
-             }
+          doorkeeper_application: {
+            name: '',
+            redirect_uri: '',
+            website: '',
+            scopes: []
+          }
+        }
       end
 
       it 'returns http success' do
@@ -121,9 +120,9 @@ describe Settings::ApplicationsController do
 
       def call_update
         patch :update, params: {
-                id: app.id,
-                doorkeeper_application: opts
-              }
+          id: app.id,
+          doorkeeper_application: opts
+        }
         response
       end
 
@@ -140,14 +139,14 @@ describe Settings::ApplicationsController do
     context 'failure' do
       before do
         patch :update, params: {
-                id: app.id,
-                doorkeeper_application: {
-                  name: '',
-                  redirect_uri: '',
-                  website: '',
-                  scopes: []
-                }
-              }
+          id: app.id,
+          doorkeeper_application: {
+            name: '',
+            redirect_uri: '',
+            website: '',
+            scopes: []
+          }
+        }
       end
 
       it 'returns http success' do
diff --git a/spec/controllers/settings/migrations_controller_spec.rb b/spec/controllers/settings/migrations_controller_spec.rb
index a621bcf1c..4d814a45e 100644
--- a/spec/controllers/settings/migrations_controller_spec.rb
+++ b/spec/controllers/settings/migrations_controller_spec.rb
@@ -10,7 +10,6 @@ describe Settings::MigrationsController do
   end
 
   describe 'GET #show' do
-
     context 'when user is not sign in' do
       subject { get :show }
 
@@ -45,7 +44,6 @@ describe Settings::MigrationsController do
   end
 
   describe 'PUT #update' do
-
     context 'when user is not sign in' do
       subject { put :update }
 
diff --git a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb
index 7612bf90e..478f24585 100644
--- a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb
+++ b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb
@@ -50,7 +50,7 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
 
       describe 'when form_two_factor_confirmation parameter is not provided' do
         it 'raises ActionController::ParameterMissing' do
-          expect { post :create, params: { } }.to raise_error(ActionController::ParameterMissing)
+          expect { post :create, params: {} }.to raise_error(ActionController::ParameterMissing)
         end
       end
 
diff --git a/spec/fabricators/account_fabricator.rb b/spec/fabricators/account_fabricator.rb
index 7aa983f82..e092e6c09 100644
--- a/spec/fabricators/account_fabricator.rb
+++ b/spec/fabricators/account_fabricator.rb
@@ -6,5 +6,5 @@ Fabricator(:account) do
   username            { sequence(:username) { |i| "#{Faker::Internet.user_name(nil, %w(_))}#{i}" } }
   last_webfingered_at { Time.now.utc }
   public_key          { public_key }
-  private_key         { private_key}
+  private_key         { private_key }
 end
diff --git a/spec/fabricators/conversation_account_fabricator.rb b/spec/fabricators/conversation_account_fabricator.rb
new file mode 100644
index 000000000..f57ffd535
--- /dev/null
+++ b/spec/fabricators/conversation_account_fabricator.rb
@@ -0,0 +1,6 @@
+Fabricator(:conversation_account) do
+  account                 nil
+  conversation            nil
+  participant_account_ids ""
+  last_status             nil
+end
diff --git a/spec/fabricators/list_fabricator.rb b/spec/fabricators/list_fabricator.rb
index 2a61b317b..c3db690fa 100644
--- a/spec/fabricators/list_fabricator.rb
+++ b/spec/fabricators/list_fabricator.rb
@@ -1,4 +1,4 @@
 Fabricator(:list) do
   account
-  title   "MyString"
+  title "MyString"
 end
diff --git a/spec/fabricators/relay_fabricator.rb b/spec/fabricators/relay_fabricator.rb
index 3f8726f6b..488913f77 100644
--- a/spec/fabricators/relay_fabricator.rb
+++ b/spec/fabricators/relay_fabricator.rb
@@ -1,4 +1,4 @@
 Fabricator(:relay) do
   inbox_url "https://example.com/inbox"
-  state   :idle
+  state :idle
 end
diff --git a/spec/fabricators/site_upload_fabricator.rb b/spec/fabricators/site_upload_fabricator.rb
index 8f4e43ac9..4a171486f 100644
--- a/spec/fabricators/site_upload_fabricator.rb
+++ b/spec/fabricators/site_upload_fabricator.rb
@@ -1,3 +1,2 @@
 Fabricator(:site_upload) do
-
 end
diff --git a/spec/fabricators/user_fabricator.rb b/spec/fabricators/user_fabricator.rb
index cf51fe81d..7dfbdb52d 100644
--- a/spec/fabricators/user_fabricator.rb
+++ b/spec/fabricators/user_fabricator.rb
@@ -2,5 +2,5 @@ Fabricator(:user) do
   account
   email        { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
   password     "123456789"
-  confirmed_at { Time.now }
+  confirmed_at { Time.zone.now }
 end
diff --git a/spec/features/log_in_spec.rb b/spec/features/log_in_spec.rb
index ed626d880..53a1f9b12 100644
--- a/spec/features/log_in_spec.rb
+++ b/spec/features/log_in_spec.rb
@@ -3,7 +3,7 @@ require "rails_helper"
 feature "Log in" do
   given(:email)        { "test@examle.com" }
   given(:password)     { "password" }
-  given(:confirmed_at) { Time.now }
+  given(:confirmed_at) { Time.zone.now }
 
   background do
     Fabricate(:user, email: email, password: password, confirmed_at: confirmed_at)
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 3ccd96f44..61780b46b 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -9,6 +9,14 @@ describe ApplicationHelper do
       expect(result).to eq "active"
     end
 
+    it 'returns active when on a current page' do
+      allow(helper).to receive(:current_page?).with('/foo').and_return(false)
+      allow(helper).to receive(:current_page?).with('/test').and_return(true)
+
+      result = helper.active_nav_class('/foo', '/test')
+      expect(result).to eq "active"
+    end
+
     it 'returns empty string when not on current page' do
       allow(helper).to receive(:current_page?).and_return(false)
 
diff --git a/spec/lib/feed_manager_spec.rb b/spec/lib/feed_manager_spec.rb
index a36ebad49..4c08e48ae 100644
--- a/spec/lib/feed_manager_spec.rb
+++ b/spec/lib/feed_manager_spec.rb
@@ -400,7 +400,7 @@ RSpec.describe FeedManager do
     end
 
     it 'sends push updates' do
-      status  = Fabricate(:status)
+      status = Fabricate(:status)
 
       FeedManager.instance.push_to_home(receiver, status)
 
diff --git a/spec/lib/formatter_spec.rb b/spec/lib/formatter_spec.rb
index 0c2248cae..ec4a6493d 100644
--- a/spec/lib/formatter_spec.rb
+++ b/spec/lib/formatter_spec.rb
@@ -170,12 +170,11 @@ RSpec.describe Formatter do
     end
   end
 
-
   describe '#format_spoiler' do
     subject { Formatter.instance.format_spoiler(status) }
 
     context 'given a post containing plain text' do
-      let(:status)  { Fabricate(:status, text: 'text', spoiler_text: 'Secret!', uri: nil) }
+      let(:status) { Fabricate(:status, text: 'text', spoiler_text: 'Secret!', uri: nil) }
 
       it 'Returns the spoiler text' do
         is_expected.to eq 'Secret!'
@@ -184,7 +183,7 @@ RSpec.describe Formatter do
 
     context 'given a post with an emoji shortcode at the start' do
       let!(:emoji) { Fabricate(:custom_emoji) }
-      let(:status)  { Fabricate(:status, text: 'text', spoiler_text: ':coolcat: Secret!', uri: nil) }
+      let(:status) { Fabricate(:status, text: 'text', spoiler_text: ':coolcat: Secret!', uri: nil) }
       let(:text) { ':coolcat: Beep boop' }
 
       it 'converts the shortcode to an image tag' do
@@ -207,7 +206,7 @@ RSpec.describe Formatter do
       end
 
       context 'given a post containing plain text' do
-        let(:status)  { Fabricate(:status, text: 'text', uri: nil) }
+        let(:status) { Fabricate(:status, text: 'text', uri: nil) }
 
         it 'paragraphizes the text' do
           is_expected.to eq '<p>text</p>'
@@ -215,7 +214,7 @@ RSpec.describe Formatter do
       end
 
       context 'given a post containing line feeds' do
-        let(:status)  { Fabricate(:status, text: "line\nfeed", uri: nil) }
+        let(:status) { Fabricate(:status, text: "line\nfeed", uri: nil) }
 
         it 'removes line feeds' do
           is_expected.not_to include "\n"
@@ -367,7 +366,7 @@ RSpec.describe Formatter do
     subject { Formatter.instance.plaintext(status) }
 
     context 'given a post with local status' do
-      let(:status)  { Fabricate(:status, text: '<p>a text by a nerd who uses an HTML tag in text</p>', uri: nil) }
+      let(:status) { Fabricate(:status, text: '<p>a text by a nerd who uses an HTML tag in text</p>', uri: nil) }
 
       it 'returns the raw text' do
         is_expected.to eq '<p>a text by a nerd who uses an HTML tag in text</p>'
@@ -375,7 +374,7 @@ RSpec.describe Formatter do
     end
 
     context 'given a post with remote status' do
-      let(:status)  { Fabricate(:status, account: remote_account, text: '<script>alert("Hello")</script>') }
+      let(:status) { Fabricate(:status, account: remote_account, text: '<script>alert("Hello")</script>') }
 
       it 'returns tag-stripped text' do
         is_expected.to eq ''
diff --git a/spec/lib/language_detector_spec.rb b/spec/lib/language_detector_spec.rb
index d00d2a0e6..0fa2a59ef 100644
--- a/spec/lib/language_detector_spec.rb
+++ b/spec/lib/language_detector_spec.rb
@@ -42,6 +42,7 @@ describe LanguageDetector do
 
   describe 'detect' do
     let(:account_without_user_locale) { Fabricate(:user, locale: nil).account }
+    let(:account_remote) { Fabricate(:account, domain: 'joinmastodon.org') }
 
     it 'detects english language for basic strings' do
       strings = [
@@ -90,7 +91,7 @@ describe LanguageDetector do
         end
 
         it 'uses nil when account is present but has no locale' do
-          result  = described_class.instance.detect('', account_without_user_locale)
+          result = described_class.instance.detect('', account_without_user_locale)
 
           expect(result).to eq nil
         end
@@ -104,6 +105,15 @@ describe LanguageDetector do
         end
       end
 
+      describe 'remote user' do
+        it 'nil for foreign user when language is not present' do
+          string = '안녕하세요'
+          result = described_class.instance.detect(string, account_remote)
+
+          expect(result).to eq nil
+        end
+      end
+
       describe 'with a non-`en` default locale' do
         around(:each) do |example|
           before = I18n.default_locale
diff --git a/spec/lib/ostatus/atom_serializer_spec.rb b/spec/lib/ostatus/atom_serializer_spec.rb
index 0bd22880e..891871c1c 100644
--- a/spec/lib/ostatus/atom_serializer_spec.rb
+++ b/spec/lib/ostatus/atom_serializer_spec.rb
@@ -728,9 +728,9 @@ RSpec.describe OStatus::AtomSerializer do
     it 'appends id element with unique tag' do
       block = Fabricate(:block)
 
-      time_before = Time.now
+      time_before = Time.zone.now
       block_salmon = OStatus::AtomSerializer.new.block_salmon(block)
-      time_after = Time.now
+      time_after = Time.zone.now
 
       expect(block_salmon.id.text).to(
         eq(OStatus::TagManager.instance.unique_tag(time_before.utc, block.id, 'Block'))
@@ -815,9 +815,9 @@ RSpec.describe OStatus::AtomSerializer do
     it 'appends id element with unique tag' do
       block = Fabricate(:block)
 
-      time_before = Time.now
+      time_before = Time.zone.now
       unblock_salmon = OStatus::AtomSerializer.new.unblock_salmon(block)
-      time_after = Time.now
+      time_after = Time.zone.now
 
       expect(unblock_salmon.id.text).to(
         eq(OStatus::TagManager.instance.unique_tag(time_before.utc, block.id, 'Block'))
@@ -880,7 +880,7 @@ RSpec.describe OStatus::AtomSerializer do
 
       ProcessInteractionService.new.call(envelope, block.target_account)
 
-      expect{ block.reload }.to raise_error ActiveRecord::RecordNotFound
+      expect { block.reload }.to raise_error ActiveRecord::RecordNotFound
     end
   end
 
@@ -994,9 +994,9 @@ RSpec.describe OStatus::AtomSerializer do
     it 'appends id element with unique tag' do
       favourite = Fabricate(:favourite)
 
-      time_before = Time.now
+      time_before = Time.zone.now
       unfavourite_salmon = OStatus::AtomSerializer.new.unfavourite_salmon(favourite)
-      time_after = Time.now
+      time_after = Time.zone.now
 
       expect(unfavourite_salmon.id.text).to(
         eq(OStatus::TagManager.instance.unique_tag(time_before.utc, favourite.id, 'Favourite'))
@@ -1179,9 +1179,9 @@ RSpec.describe OStatus::AtomSerializer do
       follow = Fabricate(:follow)
       follow.destroy!
 
-      time_before = Time.now
+      time_before = Time.zone.now
       unfollow_salmon = OStatus::AtomSerializer.new.unfollow_salmon(follow)
-      time_after = Time.now
+      time_after = Time.zone.now
 
       expect(unfollow_salmon.id.text).to(
         eq(OStatus::TagManager.instance.unique_tag(time_before.utc, follow.id, 'Follow'))
@@ -1327,9 +1327,9 @@ RSpec.describe OStatus::AtomSerializer do
     it 'appends id element with unique tag' do
       follow_request = Fabricate(:follow_request)
 
-      time_before = Time.now
+      time_before = Time.zone.now
       authorize_follow_request_salmon = OStatus::AtomSerializer.new.authorize_follow_request_salmon(follow_request)
-      time_after = Time.now
+      time_after = Time.zone.now
 
       expect(authorize_follow_request_salmon.id.text).to(
         eq(OStatus::TagManager.instance.unique_tag(time_before.utc, follow_request.id, 'FollowRequest'))
@@ -1396,9 +1396,9 @@ RSpec.describe OStatus::AtomSerializer do
     it 'appends id element with unique tag' do
       follow_request = Fabricate(:follow_request)
 
-      time_before = Time.now
+      time_before = Time.zone.now
       reject_follow_request_salmon = OStatus::AtomSerializer.new.reject_follow_request_salmon(follow_request)
-      time_after = Time.now
+      time_after = Time.zone.now
 
       expect(reject_follow_request_salmon.id.text).to(
         eq(OStatus::TagManager.instance.unique_tag(time_before.utc, follow_request.id, 'FollowRequest'))
diff --git a/spec/lib/request_spec.rb b/spec/lib/request_spec.rb
index 939ac006a..8cc5d90ce 100644
--- a/spec/lib/request_spec.rb
+++ b/spec/lib/request_spec.rb
@@ -84,7 +84,7 @@ describe Request do
         allow(Addrinfo).to receive(:foreach).with('example.com', nil, nil, :SOCK_STREAM)
                                             .and_yield(Addrinfo.new(["AF_INET", 0, "example.com", "0.0.0.0"], :PF_INET, :SOCK_STREAM))
                                             .and_yield(Addrinfo.new(["AF_INET6", 0, "example.com", "2001:db8::face"], :PF_INET6, :SOCK_STREAM))
-        expect{ subject.perform }.to raise_error Mastodon::ValidationError
+        expect { subject.perform }.to raise_error Mastodon::ValidationError
       end
     end
   end
diff --git a/spec/models/account_conversation_spec.rb b/spec/models/account_conversation_spec.rb
new file mode 100644
index 000000000..70a76281e
--- /dev/null
+++ b/spec/models/account_conversation_spec.rb
@@ -0,0 +1,72 @@
+require 'rails_helper'
+
+RSpec.describe AccountConversation, type: :model do
+  let!(:alice) { Fabricate(:account, username: 'alice') }
+  let!(:bob)   { Fabricate(:account, username: 'bob') }
+  let!(:mark)  { Fabricate(:account, username: 'mark') }
+
+  describe '.add_status' do
+    it 'creates new record when no others exist' do
+      status = Fabricate(:status, account: alice, visibility: :direct)
+      status.mentions.create(account: bob)
+
+      conversation = AccountConversation.add_status(alice, status)
+
+      expect(conversation.participant_accounts).to include(bob)
+      expect(conversation.last_status).to eq status
+      expect(conversation.status_ids).to eq [status.id]
+    end
+
+    it 'appends to old record when there is a match' do
+      last_status  = Fabricate(:status, account: alice, visibility: :direct)
+      conversation = AccountConversation.create!(account: alice, conversation: last_status.conversation, participant_account_ids: [bob.id], status_ids: [last_status.id])
+
+      status = Fabricate(:status, account: bob, visibility: :direct, thread: last_status)
+      status.mentions.create(account: alice)
+
+      new_conversation = AccountConversation.add_status(alice, status)
+
+      expect(new_conversation.id).to eq conversation.id
+      expect(new_conversation.participant_accounts).to include(bob)
+      expect(new_conversation.last_status).to eq status
+      expect(new_conversation.status_ids).to eq [last_status.id, status.id]
+    end
+
+    it 'creates new record when new participants are added' do
+      last_status  = Fabricate(:status, account: alice, visibility: :direct)
+      conversation = AccountConversation.create!(account: alice, conversation: last_status.conversation, participant_account_ids: [bob.id], status_ids: [last_status.id])
+
+      status = Fabricate(:status, account: bob, visibility: :direct, thread: last_status)
+      status.mentions.create(account: alice)
+      status.mentions.create(account: mark)
+
+      new_conversation = AccountConversation.add_status(alice, status)
+
+      expect(new_conversation.id).to_not eq conversation.id
+      expect(new_conversation.participant_accounts).to include(bob, mark)
+      expect(new_conversation.last_status).to eq status
+      expect(new_conversation.status_ids).to eq [status.id]
+    end
+  end
+
+  describe '.remove_status' do
+    it 'updates last status to a previous value' do
+      last_status  = Fabricate(:status, account: alice, visibility: :direct)
+      status       = Fabricate(:status, account: alice, visibility: :direct)
+      conversation = AccountConversation.create!(account: alice, conversation: last_status.conversation, participant_account_ids: [bob.id], status_ids: [status.id, last_status.id])
+      last_status.mentions.create(account: bob)
+      last_status.destroy!
+      conversation.reload
+      expect(conversation.last_status).to eq status
+      expect(conversation.status_ids).to eq [status.id]
+    end
+
+    it 'removes the record if no other statuses are referenced' do
+      last_status  = Fabricate(:status, account: alice, visibility: :direct)
+      conversation = AccountConversation.create!(account: alice, conversation: last_status.conversation, participant_account_ids: [bob.id], status_ids: [last_status.id])
+      last_status.mentions.create(account: bob)
+      last_status.destroy!
+      expect(AccountConversation.where(id: conversation.id).count).to eq 0
+    end
+  end
+end
diff --git a/spec/models/account_filter_spec.rb b/spec/models/account_filter_spec.rb
index 8441939c5..0a0252642 100644
--- a/spec/models/account_filter_spec.rb
+++ b/spec/models/account_filter_spec.rb
@@ -2,10 +2,10 @@ require 'rails_helper'
 
 describe AccountFilter do
   describe 'with empty params' do
-    it 'defaults to alphabetic account list' do
+    it 'defaults to recent account list' do
       filter = described_class.new({})
 
-      expect(filter.results).to eq Account.alphabetic
+      expect(filter.results).to eq Account.recent
     end
   end
 
@@ -60,7 +60,7 @@ describe AccountFilter do
     end
 
     describe 'that call account methods' do
-      %i(local remote silenced recent suspended).each do |option|
+      %i(local remote silenced alphabetic suspended).each do |option|
         it "delegates the #{option} option" do
           allow(Account).to receive(option).and_return(Account.none)
           filter = described_class.new({ option => true })
diff --git a/spec/models/account_moderation_note_spec.rb b/spec/models/account_moderation_note_spec.rb
index 16983b2e3..69bd5500a 100644
--- a/spec/models/account_moderation_note_spec.rb
+++ b/spec/models/account_moderation_note_spec.rb
@@ -1,5 +1,4 @@
 require 'rails_helper'
 
 RSpec.describe AccountModerationNote, type: :model do
-
 end
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index 6a3f9e6ec..5baf70ef9 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -275,7 +275,7 @@ RSpec.describe Account, type: :model do
 
     subject { Fabricate(:account) }
 
-    context 'when the status is a reblog of another status'do
+    context 'when the status is a reblog of another status' do
       let(:original_reblog) do
         author = Fabricate(:account, username: 'original_reblogger')
         Fabricate(:status, reblog: original_status, account: author)
diff --git a/spec/models/admin/action_log_spec.rb b/spec/models/admin/action_log_spec.rb
index 59206a36b..81d7e1be3 100644
--- a/spec/models/admin/action_log_spec.rb
+++ b/spec/models/admin/action_log_spec.rb
@@ -1,5 +1,4 @@
 require 'rails_helper'
 
 RSpec.describe Admin::ActionLog, type: :model do
-
 end
diff --git a/spec/models/backup_spec.rb b/spec/models/backup_spec.rb
index fabcdc845..45230986d 100644
--- a/spec/models/backup_spec.rb
+++ b/spec/models/backup_spec.rb
@@ -1,5 +1,4 @@
 require 'rails_helper'
 
 RSpec.describe Backup, type: :model do
-
 end
diff --git a/spec/models/conversation_mute_spec.rb b/spec/models/conversation_mute_spec.rb
index b602e80c1..3fc2915d4 100644
--- a/spec/models/conversation_mute_spec.rb
+++ b/spec/models/conversation_mute_spec.rb
@@ -1,5 +1,4 @@
 require 'rails_helper'
 
 RSpec.describe ConversationMute, type: :model do
-
 end
diff --git a/spec/models/custom_emoji_spec.rb b/spec/models/custom_emoji_spec.rb
index 87367df50..320a258d3 100644
--- a/spec/models/custom_emoji_spec.rb
+++ b/spec/models/custom_emoji_spec.rb
@@ -4,7 +4,7 @@ RSpec.describe CustomEmoji, type: :model do
   describe '#search' do
     let(:custom_emoji) { Fabricate(:custom_emoji, shortcode: shortcode) }
 
-    subject  { described_class.search(search_term) }
+    subject { described_class.search(search_term) }
 
     context 'shortcode is exact' do
       let(:shortcode) { 'blobpats' }
diff --git a/spec/models/custom_filter_spec.rb b/spec/models/custom_filter_spec.rb
index 1024542e7..3943dd5f1 100644
--- a/spec/models/custom_filter_spec.rb
+++ b/spec/models/custom_filter_spec.rb
@@ -1,5 +1,4 @@
 require 'rails_helper'
 
 RSpec.describe CustomFilter, type: :model do
-
 end
diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb
index f221973b6..0c84e5e7b 100644
--- a/spec/models/follow_spec.rb
+++ b/spec/models/follow_spec.rb
@@ -23,6 +23,20 @@ RSpec.describe Follow, type: :model do
       follow.valid?
       expect(follow).to model_have_error_on_field(:target_account)
     end
+
+    it 'is invalid if account already follows too many people' do
+      alice.update(following_count: FollowLimitValidator::LIMIT)
+
+      expect(subject).to_not be_valid
+      expect(subject).to model_have_error_on_field(:base)
+    end
+
+    it 'is valid if account is only on the brink of following too many people' do
+      alice.update(following_count: FollowLimitValidator::LIMIT - 1)
+
+      expect(subject).to be_valid
+      expect(subject).to_not model_have_error_on_field(:base)
+    end
   end
 
   describe 'recent' do
diff --git a/spec/models/list_account_spec.rb b/spec/models/list_account_spec.rb
index a132e09b0..a0cf02efe 100644
--- a/spec/models/list_account_spec.rb
+++ b/spec/models/list_account_spec.rb
@@ -1,5 +1,4 @@
 require 'rails_helper'
 
 RSpec.describe ListAccount, type: :model do
-
 end
diff --git a/spec/models/list_spec.rb b/spec/models/list_spec.rb
index c302482b4..b780bb1de 100644
--- a/spec/models/list_spec.rb
+++ b/spec/models/list_spec.rb
@@ -1,5 +1,4 @@
 require 'rails_helper'
 
 RSpec.describe List, type: :model do
-
 end
diff --git a/spec/models/media_attachment_spec.rb b/spec/models/media_attachment_spec.rb
index cb1cee518..266cd4920 100644
--- a/spec/models/media_attachment_spec.rb
+++ b/spec/models/media_attachment_spec.rb
@@ -131,7 +131,7 @@ RSpec.describe MediaAttachment, type: :model do
       expect(media.file.meta["original"]["aspect"]).to eq 1.5
       expect(media.file.meta["small"]["width"]).to eq 490
       expect(media.file.meta["small"]["height"]).to eq 327
-      expect(media.file.meta["small"]["aspect"]).to eq 490.0/327
+      expect(media.file.meta["small"]["aspect"]).to eq 490.0 / 327
     end
   end
 
diff --git a/spec/models/mute_spec.rb b/spec/models/mute_spec.rb
index 83ba793b2..38a87bdf4 100644
--- a/spec/models/mute_spec.rb
+++ b/spec/models/mute_spec.rb
@@ -1,5 +1,4 @@
 require 'rails_helper'
 
 RSpec.describe Mute, type: :model do
-
 end
diff --git a/spec/models/preview_card_spec.rb b/spec/models/preview_card_spec.rb
index 14ef23923..45233d1d4 100644
--- a/spec/models/preview_card_spec.rb
+++ b/spec/models/preview_card_spec.rb
@@ -1,5 +1,4 @@
 require 'rails_helper'
 
 RSpec.describe PreviewCard, type: :model do
-
 end
diff --git a/spec/models/remote_follow_spec.rb b/spec/models/remote_follow_spec.rb
index 72c580f9f..ed2667b28 100644
--- a/spec/models/remote_follow_spec.rb
+++ b/spec/models/remote_follow_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe RemoteFollow do
     subject { remote_follow.valid? }
 
     context 'attrs with acct' do
-      let(:attrs) { { acct: 'gargron@quitter.no' }}
+      let(:attrs) { { acct: 'gargron@quitter.no' } }
 
       it do
         is_expected.to be true
@@ -42,7 +42,7 @@ RSpec.describe RemoteFollow do
     end
 
     context 'attrs without acct' do
-      let(:attrs) { { } }
+      let(:attrs) { {} }
 
       it do
         is_expected.to be false
diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb
index 512dc258e..8e90b92d0 100644
--- a/spec/models/status_spec.rb
+++ b/spec/models/status_spec.rb
@@ -154,7 +154,7 @@ RSpec.describe Status, type: :model do
 
   describe '#target' do
     it 'returns nil if the status is self-contained' do
-     expect(subject.target).to be_nil
+      expect(subject.target).to be_nil
     end
 
     it 'returns nil if the status is a reply' do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 015e90edc..8c6778edc 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -67,7 +67,7 @@ RSpec.describe User, type: :model do
     describe 'confirmed' do
       it 'returns an array of users who are confirmed' do
         user_1 = Fabricate(:user, confirmed_at: nil)
-        user_2 = Fabricate(:user, confirmed_at: Time.now)
+        user_2 = Fabricate(:user, confirmed_at: Time.zone.now)
         expect(User.confirmed).to match_array([user_2])
       end
     end
@@ -254,7 +254,7 @@ RSpec.describe User, type: :model do
 
   it_behaves_like 'Settings-extended' do
     def create!
-      User.create!(account: Fabricate(:account), email: 'foo@mastodon.space', password: 'abcd1234' )
+      User.create!(account: Fabricate(:account), email: 'foo@mastodon.space', password: 'abcd1234')
     end
 
     def fabricate
diff --git a/spec/models/web/setting_spec.rb b/spec/models/web/setting_spec.rb
index 90e7695aa..6657d4030 100644
--- a/spec/models/web/setting_spec.rb
+++ b/spec/models/web/setting_spec.rb
@@ -1,5 +1,4 @@
 require 'rails_helper'
 
 RSpec.describe Web::Setting, type: :model do
-
 end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 79e80220c..1ded751ab 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -72,11 +72,11 @@ RSpec::Sidekiq.configure do |config|
 end
 
 def request_fixture(name)
-  File.read(File.join(Rails.root, 'spec', 'fixtures', 'requests', name))
+  File.read(Rails.root.join('spec', 'fixtures', 'requests', name))
 end
 
 def attachment_fixture(name)
-  File.open(File.join(Rails.root, 'spec', 'fixtures', 'files', name))
+  File.open(Rails.root.join('spec', 'fixtures', 'files', name))
 end
 
 def stub_jsonld_contexts!
diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb
index e46f0ae45..bbe97d211 100644
--- a/spec/services/activitypub/process_collection_service_spec.rb
+++ b/spec/services/activitypub/process_collection_service_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
       end
 
       it 'processes payload with actor if valid signature exists' do
-        payload['signature'] = {'type' => 'RsaSignature2017'}
+        payload['signature'] = { 'type' => 'RsaSignature2017' }
 
         expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_account!).and_return(actor)
         expect(ActivityPub::Activity).to receive(:factory).with(instance_of(Hash), actor, instance_of(Hash))
@@ -43,7 +43,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
       end
 
       it 'does not process payload if invalid signature exists' do
-        payload['signature'] = {'type' => 'RsaSignature2017'}
+        payload['signature'] = { 'type' => 'RsaSignature2017' }
 
         expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_account!).and_return(nil)
         expect(ActivityPub::Activity).not_to receive(:factory)
diff --git a/spec/services/batched_remove_status_service_spec.rb b/spec/services/batched_remove_status_service_spec.rb
index 23c122e59..c66214555 100644
--- a/spec/services/batched_remove_status_service_spec.rb
+++ b/spec/services/batched_remove_status_service_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe BatchedRemoveStatusService, type: :service do
     stub_request(:post, 'http://example.com/inbox').to_return(status: 200)
 
     Fabricate(:subscription, account: alice, callback_url: 'http://example.com/push', confirmed: true, expires_at: 30.days.from_now)
-    jeff.user.update(current_sign_in_at: Time.now)
+    jeff.user.update(current_sign_in_at: Time.zone.now)
     jeff.follow!(alice)
     hank.follow!(alice)
 
diff --git a/spec/services/fetch_atom_service_spec.rb b/spec/services/fetch_atom_service_spec.rb
index bb233c12d..30e5b0935 100644
--- a/spec/services/fetch_atom_service_spec.rb
+++ b/spec/services/fetch_atom_service_spec.rb
@@ -57,7 +57,7 @@ RSpec.describe FetchAtomService, type: :service do
       context 'content type is application/atom+xml' do
         let(:content_type) { 'application/atom+xml' }
 
-        it { is_expected.to eq [url, {:prefetched_body=>""}, :ostatus] }
+        it { is_expected.to eq [url, { :prefetched_body => "" }, :ostatus] }
       end
 
       context 'content_type is json' do
diff --git a/spec/services/fetch_remote_account_service_spec.rb b/spec/services/fetch_remote_account_service_spec.rb
index 20dd505d0..3cd86708b 100644
--- a/spec/services/fetch_remote_account_service_spec.rb
+++ b/spec/services/fetch_remote_account_service_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe FetchRemoteAccountService, type: :service do
   end
 
   let(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice' }] } }
-  let(:xml) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'xml', 'mastodon.atom')) }
+  let(:xml) { File.read(Rails.root.join('spec', 'fixtures', 'xml', 'mastodon.atom')) }
 
   shared_examples 'return Account' do
     it { is_expected.to be_an Account }
diff --git a/spec/services/process_feed_service_spec.rb b/spec/services/process_feed_service_spec.rb
index 1f26660ed..9d3465f3f 100644
--- a/spec/services/process_feed_service_spec.rb
+++ b/spec/services/process_feed_service_spec.rb
@@ -4,7 +4,7 @@ RSpec.describe ProcessFeedService, type: :service do
   subject { ProcessFeedService.new }
 
   describe 'processing a feed' do
-    let(:body) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'xml', 'mastodon.atom')) }
+    let(:body) { File.read(Rails.root.join('spec', 'fixtures', 'xml', 'mastodon.atom')) }
     let(:account) { Fabricate(:account, username: 'localhost', domain: 'kickass.zone') }
 
     before do
diff --git a/spec/services/update_remote_profile_service_spec.rb b/spec/services/update_remote_profile_service_spec.rb
index 7ac3a809a..f3ea70b80 100644
--- a/spec/services/update_remote_profile_service_spec.rb
+++ b/spec/services/update_remote_profile_service_spec.rb
@@ -1,7 +1,7 @@
 require 'rails_helper'
 
 RSpec.describe UpdateRemoteProfileService, type: :service do
-  let(:xml) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'push', 'feed.atom')) }
+  let(:xml) { File.read(Rails.root.join('spec', 'fixtures', 'push', 'feed.atom')) }
 
   subject { UpdateRemoteProfileService.new }
 
diff --git a/spec/services/verify_link_service_spec.rb b/spec/services/verify_link_service_spec.rb
index 9b04d6136..2edcdb75f 100644
--- a/spec/services/verify_link_service_spec.rb
+++ b/spec/services/verify_link_service_spec.rb
@@ -3,80 +3,107 @@ require 'rails_helper'
 RSpec.describe VerifyLinkService, type: :service do
   subject { described_class.new }
 
-  let(:account) { Fabricate(:account, username: 'alice') }
-  let(:field)   { Account::Field.new(account, 'name' => 'Website', 'value' => 'http://example.com') }
+  context 'given a local account' do
+    let(:account) { Fabricate(:account, username: 'alice') }
+    let(:field)   { Account::Field.new(account, 'name' => 'Website', 'value' => 'http://example.com') }
 
-  before do
-    stub_request(:head, 'https://redirect.me/abc').to_return(status: 301, headers: { 'Location' => ActivityPub::TagManager.instance.url_for(account) })
-    stub_request(:get, 'http://example.com').to_return(status: 200, body: html)
-    subject.call(field)
-  end
-
-  context 'when a link contains an <a> back' do
-    let(:html) do
-      <<-HTML
-        <!doctype html>
-        <body>
-          <a href="#{ActivityPub::TagManager.instance.url_for(account)}" rel="me">Follow me on Mastodon</a>
-        </body>
-      HTML
+    before do
+      stub_request(:head, 'https://redirect.me/abc').to_return(status: 301, headers: { 'Location' => ActivityPub::TagManager.instance.url_for(account) })
+      stub_request(:get, 'http://example.com').to_return(status: 200, body: html)
+      subject.call(field)
     end
 
-    it 'marks the field as verified' do
-      expect(field.verified?).to be true
+    context 'when a link contains an <a> back' do
+      let(:html) do
+        <<-HTML
+          <!doctype html>
+          <body>
+            <a href="#{ActivityPub::TagManager.instance.url_for(account)}" rel="me">Follow me on Mastodon</a>
+          </body>
+        HTML
+      end
+
+      it 'marks the field as verified' do
+        expect(field.verified?).to be true
+      end
     end
-  end
 
-  context 'when a link contains an <a rel="noopener"> back' do
-    let(:html) do
-      <<-HTML
-        <!doctype html>
-        <body>
-          <a href="#{ActivityPub::TagManager.instance.url_for(account)}" rel="noopener me" target="_blank">Follow me on Mastodon</a>
-        </body>
-      HTML
+    context 'when a link contains an <a rel="noopener"> back' do
+      let(:html) do
+        <<-HTML
+          <!doctype html>
+          <body>
+            <a href="#{ActivityPub::TagManager.instance.url_for(account)}" rel="noopener me" target="_blank">Follow me on Mastodon</a>
+          </body>
+        HTML
+      end
+
+      it 'marks the field as verified' do
+        expect(field.verified?).to be true
+      end
     end
 
-    it 'marks the field as verified' do
-      expect(field.verified?).to be true
+    context 'when a link contains a <link> back' do
+      let(:html) do
+        <<-HTML
+          <!doctype html>
+          <head>
+            <link type="text/html" href="#{ActivityPub::TagManager.instance.url_for(account)}" rel="me" />
+          </head>
+        HTML
+      end
+
+      it 'marks the field as verified' do
+        expect(field.verified?).to be true
+      end
     end
-  end
 
-  context 'when a link contains a <link> back' do
-    let(:html) do
-      <<-HTML
-        <!doctype html>
-        <head>
-          <link type="text/html" href="#{ActivityPub::TagManager.instance.url_for(account)}" rel="me" />
-        </head>
-      HTML
+    context 'when a link goes through a redirect back' do
+      let(:html) do
+        <<-HTML
+          <!doctype html>
+          <head>
+            <link type="text/html" href="https://redirect.me/abc" rel="me" />
+          </head>
+        HTML
+      end
+
+      it 'marks the field as verified' do
+        expect(field.verified?).to be true
+      end
     end
 
-    it 'marks the field as verified' do
-      expect(field.verified?).to be true
+    context 'when a link does not contain a link back' do
+      let(:html) { '' }
+
+      it 'marks the field as verified' do
+        expect(field.verified?).to be false
+      end
     end
   end
 
-  context 'when a link goes through a redirect back' do
-    let(:html) do
-      <<-HTML
-        <!doctype html>
-        <head>
-          <link type="text/html" href="https://redirect.me/abc" rel="me" />
-        </head>
-      HTML
-    end
+  context '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>') }
 
-    it 'marks the field as verified' do
-      expect(field.verified?).to be true
+    before do
+      stub_request(:get, 'http://example.com').to_return(status: 200, body: html)
+      subject.call(field)
     end
-  end
 
-  context 'when a link does not contain a link back' do
-    let(:html) { '' }
+    context 'when a link contains an <a> back' do
+      let(:html) do
+        <<-HTML
+          <!doctype html>
+          <body>
+            <a href="https://profile.example.com/alice" rel="me">Follow me on Mastodon</a>
+          </body>
+        HTML
+      end
 
-    it 'marks the field as verified' do
-      expect(field.verified?).to be false
+      it 'marks the field as verified' do
+        expect(field.verified?).to be true
+      end
     end
   end
 end
diff --git a/spec/views/about/show.html.haml_spec.rb b/spec/views/about/show.html.haml_spec.rb
index e15c72cec..65124fcf2 100644
--- a/spec/views/about/show.html.haml_spec.rb
+++ b/spec/views/about/show.html.haml_spec.rb
@@ -20,6 +20,7 @@ describe 'about/show.html.haml', without_verify_partial_doubles: true do
                                 open_registrations: false,
                                 thumbnail: nil,
                                 hero: nil,
+                                mascot: nil,
                                 user_count: 0,
                                 status_count: 0,
                                 commit_hash: commit_hash,
diff --git a/spec/views/stream_entries/show.html.haml_spec.rb b/spec/views/stream_entries/show.html.haml_spec.rb
index d06bb7abb..93f0adb99 100644
--- a/spec/views/stream_entries/show.html.haml_spec.rb
+++ b/spec/views/stream_entries/show.html.haml_spec.rb
@@ -49,8 +49,8 @@ describe 'stream_entries/show.html.haml', without_verify_partial_doubles: true d
     assign(:stream_entry, reply.stream_entry)
     assign(:account, alice)
     assign(:type, reply.stream_entry.activity_type.downcase)
-    assign(:ancestors, reply.stream_entry.activity.ancestors(1, bob) )
-    assign(:descendant_threads, [{ statuses: reply.stream_entry.activity.descendants(1)}])
+    assign(:ancestors, reply.stream_entry.activity.ancestors(1, bob))
+    assign(:descendant_threads, [{ statuses: reply.stream_entry.activity.descendants(1) }])
 
     render