about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-04-28 09:12:37 -0400
committerEugen Rochko <eugen@zeonfederated.com>2017-04-28 15:12:37 +0200
commit9566893cc973671f151ceabf266d260ebba57492 (patch)
tree1f575905b552ba758a08300b96c91122e3ef6dc4 /spec/controllers
parent0e2589867f2a54fe9a71c20560d90d7f77c12bd3 (diff)
More controller specs (#2561)
* Add render_views in more places

* Delegate methods from account to user with allow nil true, so that admin accounts show view renders when missing a user

* Use actual account instances in authorize follow controller spec
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/account_follow_controller_spec.rb1
-rw-r--r--spec/controllers/account_unfollow_controller_spec.rb1
-rw-r--r--spec/controllers/admin/accounts_controller_spec.rb2
-rw-r--r--spec/controllers/admin/domain_blocks_controller_spec.rb2
-rw-r--r--spec/controllers/admin/instances_controller_spec.rb2
-rw-r--r--spec/controllers/admin/pubsubhubbub_controller_spec.rb2
-rw-r--r--spec/controllers/admin/reported_statuses_controller_spec.rb2
-rw-r--r--spec/controllers/admin/resets_controller_spec.rb2
-rw-r--r--spec/controllers/admin/silences_controller_spec.rb2
-rw-r--r--spec/controllers/admin/suspensions_controller_spec.rb2
-rw-r--r--spec/controllers/authorize_follows_controller_spec.rb6
-rw-r--r--spec/controllers/follower_accounts_controller_spec.rb1
-rw-r--r--spec/controllers/following_accounts_controller_spec.rb1
-rw-r--r--spec/controllers/media_controller_spec.rb2
-rw-r--r--spec/controllers/oauth/authorizations_controller_spec.rb2
-rw-r--r--spec/controllers/settings/exports/blocked_accounts_controller_spec.rb2
-rw-r--r--spec/controllers/settings/exports/following_accounts_controller_spec.rb2
-rw-r--r--spec/controllers/settings/exports/muted_accounts_controller_spec.rb2
-rw-r--r--spec/controllers/settings/follower_domains_controller_spec.rb2
-rw-r--r--spec/controllers/settings/imports_controller_spec.rb1
-rw-r--r--spec/controllers/settings/preferences_controller_spec.rb2
-rw-r--r--spec/controllers/settings/profiles_controller_spec.rb1
22 files changed, 40 insertions, 2 deletions
diff --git a/spec/controllers/account_follow_controller_spec.rb b/spec/controllers/account_follow_controller_spec.rb
index 479101c67..b0e646c1f 100644
--- a/spec/controllers/account_follow_controller_spec.rb
+++ b/spec/controllers/account_follow_controller_spec.rb
@@ -2,6 +2,7 @@ require 'rails_helper'
 
 describe AccountFollowController do
   render_views
+
   let(:user) { Fabricate(:user) }
   let(:alice) { Fabricate(:account, username: 'alice') }
 
diff --git a/spec/controllers/account_unfollow_controller_spec.rb b/spec/controllers/account_unfollow_controller_spec.rb
index 1f28bf4ab..a6c86d4b9 100644
--- a/spec/controllers/account_unfollow_controller_spec.rb
+++ b/spec/controllers/account_unfollow_controller_spec.rb
@@ -2,6 +2,7 @@ require 'rails_helper'
 
 describe AccountUnfollowController do
   render_views
+
   let(:user) { Fabricate(:user) }
   let(:alice) { Fabricate(:account, username: 'alice') }
 
diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb
index 47b1267e8..305260475 100644
--- a/spec/controllers/admin/accounts_controller_spec.rb
+++ b/spec/controllers/admin/accounts_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 RSpec.describe Admin::AccountsController, type: :controller do
+  render_views
+
   before do
     sign_in Fabricate(:user, admin: true), scope: :user
   end
diff --git a/spec/controllers/admin/domain_blocks_controller_spec.rb b/spec/controllers/admin/domain_blocks_controller_spec.rb
index 9d8735ef2..4578efb02 100644
--- a/spec/controllers/admin/domain_blocks_controller_spec.rb
+++ b/spec/controllers/admin/domain_blocks_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 RSpec.describe Admin::DomainBlocksController, type: :controller do
+  render_views
+
   before do
     sign_in Fabricate(:user, admin: true), scope: :user
   end
diff --git a/spec/controllers/admin/instances_controller_spec.rb b/spec/controllers/admin/instances_controller_spec.rb
index c50ea352f..37fa8dd9a 100644
--- a/spec/controllers/admin/instances_controller_spec.rb
+++ b/spec/controllers/admin/instances_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 RSpec.describe Admin::InstancesController, type: :controller do
+  render_views
+
   before do
     sign_in Fabricate(:user, admin: true), scope: :user
   end
diff --git a/spec/controllers/admin/pubsubhubbub_controller_spec.rb b/spec/controllers/admin/pubsubhubbub_controller_spec.rb
index 068bd09a6..c2bab5dac 100644
--- a/spec/controllers/admin/pubsubhubbub_controller_spec.rb
+++ b/spec/controllers/admin/pubsubhubbub_controller_spec.rb
@@ -2,6 +2,8 @@
 require 'rails_helper'
 
 RSpec.describe Admin::PubsubhubbubController, type: :controller do
+  render_views
+
   describe 'GET #index' do
     before do
       sign_in Fabricate(:user, admin: true), scope: :user
diff --git a/spec/controllers/admin/reported_statuses_controller_spec.rb b/spec/controllers/admin/reported_statuses_controller_spec.rb
index 4d6926e1a..dea5ea55d 100644
--- a/spec/controllers/admin/reported_statuses_controller_spec.rb
+++ b/spec/controllers/admin/reported_statuses_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 describe Admin::ReportedStatusesController do
+  render_views
+
   let(:user) { Fabricate(:user, admin: true) }
   before do
     sign_in user, scope: :user
diff --git a/spec/controllers/admin/resets_controller_spec.rb b/spec/controllers/admin/resets_controller_spec.rb
index 283ab029f..a0a77478e 100644
--- a/spec/controllers/admin/resets_controller_spec.rb
+++ b/spec/controllers/admin/resets_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 describe Admin::ResetsController do
+  render_views
+
   let(:account) { Fabricate(:account, user: Fabricate(:user)) }
   before do
     sign_in Fabricate(:user, admin: true), scope: :user
diff --git a/spec/controllers/admin/silences_controller_spec.rb b/spec/controllers/admin/silences_controller_spec.rb
index 7c541d797..16b326542 100644
--- a/spec/controllers/admin/silences_controller_spec.rb
+++ b/spec/controllers/admin/silences_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 describe Admin::SilencesController do
+  render_views
+
   let(:account) { Fabricate(:account) }
   before do
     sign_in Fabricate(:user, admin: true), scope: :user
diff --git a/spec/controllers/admin/suspensions_controller_spec.rb b/spec/controllers/admin/suspensions_controller_spec.rb
index 9096f067e..2d9adc23d 100644
--- a/spec/controllers/admin/suspensions_controller_spec.rb
+++ b/spec/controllers/admin/suspensions_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 describe Admin::SuspensionsController do
+  render_views
+
   let(:account) { Fabricate(:account) }
   before do
     sign_in Fabricate(:user, admin: true), scope: :user
diff --git a/spec/controllers/authorize_follows_controller_spec.rb b/spec/controllers/authorize_follows_controller_spec.rb
index f65b620cc..87a46cf8e 100644
--- a/spec/controllers/authorize_follows_controller_spec.rb
+++ b/spec/controllers/authorize_follows_controller_spec.rb
@@ -3,6 +3,8 @@
 require 'rails_helper'
 
 describe AuthorizeFollowsController do
+  render_views
+
   describe 'GET #show' do
     describe 'when signed out' do
       it 'redirects to sign in page' do
@@ -38,7 +40,7 @@ describe AuthorizeFollowsController do
       end
 
       it 'sets account from url' do
-        account = double
+        account = Account.new
         service = double
         allow(FetchRemoteAccountService).to receive(:new).and_return(service)
         allow(service).to receive(:call).with('http://example.com').and_return(account)
@@ -50,7 +52,7 @@ describe AuthorizeFollowsController do
       end
 
       it 'sets account from acct uri' do
-        account = double
+        account = Account.new
         service = double
         allow(FollowRemoteAccountService).to receive(:new).and_return(service)
         allow(service).to receive(:call).with('found@hostname').and_return(account)
diff --git a/spec/controllers/follower_accounts_controller_spec.rb b/spec/controllers/follower_accounts_controller_spec.rb
index 82d2b2067..f2082f601 100644
--- a/spec/controllers/follower_accounts_controller_spec.rb
+++ b/spec/controllers/follower_accounts_controller_spec.rb
@@ -2,6 +2,7 @@ require 'rails_helper'
 
 describe FollowerAccountsController do
   render_views
+
   let(:alice) { Fabricate(:account, username: 'alice') }
 
   describe 'GET #index' do
diff --git a/spec/controllers/following_accounts_controller_spec.rb b/spec/controllers/following_accounts_controller_spec.rb
index 5b5a6fe5f..f4a7e88f9 100644
--- a/spec/controllers/following_accounts_controller_spec.rb
+++ b/spec/controllers/following_accounts_controller_spec.rb
@@ -2,6 +2,7 @@ require 'rails_helper'
 
 describe FollowingAccountsController do
   render_views
+
   let(:alice) { Fabricate(:account, username: 'alice') }
 
   describe 'GET #index' do
diff --git a/spec/controllers/media_controller_spec.rb b/spec/controllers/media_controller_spec.rb
index ebf6aa006..2541df734 100644
--- a/spec/controllers/media_controller_spec.rb
+++ b/spec/controllers/media_controller_spec.rb
@@ -3,6 +3,8 @@
 require 'rails_helper'
 
 describe MediaController do
+  render_views
+
   describe '#show' do
     it 'redirects to the file url when attached to a status' do
       status = Fabricate(:status)
diff --git a/spec/controllers/oauth/authorizations_controller_spec.rb b/spec/controllers/oauth/authorizations_controller_spec.rb
index 0e3b34bf0..a5997bba3 100644
--- a/spec/controllers/oauth/authorizations_controller_spec.rb
+++ b/spec/controllers/oauth/authorizations_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 RSpec.describe Oauth::AuthorizationsController, type: :controller do
diff --git a/spec/controllers/settings/exports/blocked_accounts_controller_spec.rb b/spec/controllers/settings/exports/blocked_accounts_controller_spec.rb
index c815bdfec..e79a6729a 100644
--- a/spec/controllers/settings/exports/blocked_accounts_controller_spec.rb
+++ b/spec/controllers/settings/exports/blocked_accounts_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 describe Settings::Exports::BlockedAccountsController do
+  render_views
+
   before do
     sign_in Fabricate(:user), scope: :user
   end
diff --git a/spec/controllers/settings/exports/following_accounts_controller_spec.rb b/spec/controllers/settings/exports/following_accounts_controller_spec.rb
index a7029709c..503455fea 100644
--- a/spec/controllers/settings/exports/following_accounts_controller_spec.rb
+++ b/spec/controllers/settings/exports/following_accounts_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 describe Settings::Exports::FollowingAccountsController do
+  render_views
+
   before do
     sign_in Fabricate(:user), scope: :user
   end
diff --git a/spec/controllers/settings/exports/muted_accounts_controller_spec.rb b/spec/controllers/settings/exports/muted_accounts_controller_spec.rb
index bb52b6fcf..37c3a0fcf 100644
--- a/spec/controllers/settings/exports/muted_accounts_controller_spec.rb
+++ b/spec/controllers/settings/exports/muted_accounts_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 describe Settings::Exports::MutedAccountsController do
+  render_views
+
   before do
     sign_in Fabricate(:user), scope: :user
   end
diff --git a/spec/controllers/settings/follower_domains_controller_spec.rb b/spec/controllers/settings/follower_domains_controller_spec.rb
index 1afdb9757..d48c3e68c 100644
--- a/spec/controllers/settings/follower_domains_controller_spec.rb
+++ b/spec/controllers/settings/follower_domains_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 describe Settings::FollowerDomainsController do
+  render_views
+
   let(:user) { Fabricate(:user) }
 
   before do
diff --git a/spec/controllers/settings/imports_controller_spec.rb b/spec/controllers/settings/imports_controller_spec.rb
index d57350a14..8bf6aec2b 100644
--- a/spec/controllers/settings/imports_controller_spec.rb
+++ b/spec/controllers/settings/imports_controller_spec.rb
@@ -1,6 +1,7 @@
 require 'rails_helper'
 
 RSpec.describe Settings::ImportsController, type: :controller do
+  render_views
 
   before do
     sign_in Fabricate(:user), scope: :user
diff --git a/spec/controllers/settings/preferences_controller_spec.rb b/spec/controllers/settings/preferences_controller_spec.rb
index 0d3dc059a..92b626d2d 100644
--- a/spec/controllers/settings/preferences_controller_spec.rb
+++ b/spec/controllers/settings/preferences_controller_spec.rb
@@ -1,6 +1,8 @@
 require 'rails_helper'
 
 describe Settings::PreferencesController do
+  render_views
+
   let(:user) { Fabricate(:user) }
 
   before do
diff --git a/spec/controllers/settings/profiles_controller_spec.rb b/spec/controllers/settings/profiles_controller_spec.rb
index 526bbc5bc..b3d6bc47d 100644
--- a/spec/controllers/settings/profiles_controller_spec.rb
+++ b/spec/controllers/settings/profiles_controller_spec.rb
@@ -1,6 +1,7 @@
 require 'rails_helper'
 
 RSpec.describe Settings::ProfilesController, type: :controller do
+  render_views
 
   before do
     sign_in Fabricate(:user), scope: :user