about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers')
-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/v1/accounts_controller_spec.rb4
-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/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
21 files changed, 60 insertions, 66 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/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/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/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