]> cat aescling's git repositories - mastodon.git/commitdiff
Fix tests
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 18 Aug 2016 15:13:41 +0000 (17:13 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 18 Aug 2016 15:22:44 +0000 (17:22 +0200)
app/controllers/application_controller.rb
app/services/fan_out_on_write_service.rb
app/views/api/accounts/show.rabl
app/views/api/statuses/show.rabl
config/database.yml
config/initializers/rack-mini-profiler.rb

index f90628b0d42cc913c5a93844d265ec7dd9388580..b10fa977e749d05fddbc407f5610e47f96299e52 100644 (file)
@@ -9,4 +9,10 @@ class ApplicationController < ActionController::Base
       Rack::MiniProfiler.authorize_request
     end
   end
+
+  protected
+
+  def current_account
+    current_user.try(:account)
+  end
 end
index 34684a06f3222d2e36ec844b0c8f9de654e971a1..dc030736be5f5c5d04c90daafcdc9f62ce19af93 100644 (file)
@@ -54,6 +54,10 @@ class FanOutOnWriteService < BaseService
       def current_user
         @account.user
       end
+
+      def current_account
+        @account
+      end
     end
 
     Rabl::Renderer.new('api/statuses/show', status,  view_path: 'app/views', format: :json, scope: rabl_scope.new(receiver)).render
index df70943dd6229652739f049401aa438ec595e9fe..05c92c99dd97cd93aa02ca12840dbb2237ffd9d9 100644 (file)
@@ -7,4 +7,4 @@ node(:avatar)          { |account| asset_url(account.avatar.url(:large, false))
 node(:followers_count) { |account| account.followers.count }
 node(:following_count) { |account| account.following.count }
 node(:statuses_count)  { |account| account.statuses.count  }
-node(:following)       { |account| current_user.account.following?(account) }
+node(:following)       { |account| current_account.following?(account) }
index b4a73f9a6e32f55a0b8a6f117a8658ea0c781e0d..0f44188704ae3cb48b9b67b870b6fc74d70d6c72 100644 (file)
@@ -6,8 +6,8 @@ node(:content)          { |status| content_for_status(status) }
 node(:url)              { |status| url_for_target(status) }
 node(:reblogs_count)    { |status| status.reblogs_count }
 node(:favourites_count) { |status| status.favourites_count }
-node(:favourited)       { |status| current_user.account.favourited?(status) }
-node(:reblogged)        { |status| current_user.account.reblogged?(status) }
+node(:favourited)       { |status| current_account.favourited?(status) }
+node(:reblogged)        { |status| current_account.reblogged?(status) }
 
 child :reblog => :reblog do
   extends('api/statuses/show')
index da88c65a0050688fe33de4a8637468079b96a697..e0df97ad2c9d07b5dec7f479499318c5c6ee10cb 100644 (file)
@@ -1,6 +1,6 @@
 default: &default
   adapter: postgresql
-  pool: 15
+  pool: 17
   timeout: 5000
   encoding: unicode
 
index 7fd50a9af770099549d7769c0bb9cd67e1e66e48..01e8aaa15a71ae9225fe792a21168aecc3eaad7d 100644 (file)
@@ -1,2 +1,4 @@
-Rails.application.middleware.swap(Rack::Deflater, Rack::MiniProfiler)
-Rails.application.middleware.swap(Rack::MiniProfiler, Rack::Deflater)
+unless Rails.env == 'test'
+  Rails.application.middleware.swap(Rack::Deflater, Rack::MiniProfiler)
+  Rails.application.middleware.swap(Rack::MiniProfiler, Rack::Deflater)
+end