Fix tests

This commit is contained in:
Eugen Rochko 2016-08-18 17:13:41 +02:00
parent 6deb9f966e
commit 6426819b6f
6 changed files with 18 additions and 6 deletions

View file

@ -9,4 +9,10 @@ class ApplicationController < ActionController::Base
Rack::MiniProfiler.authorize_request Rack::MiniProfiler.authorize_request
end end
end end
protected
def current_account
current_user.try(:account)
end
end end

View file

@ -54,6 +54,10 @@ class FanOutOnWriteService < BaseService
def current_user def current_user
@account.user @account.user
end end
def current_account
@account
end
end end
Rabl::Renderer.new('api/statuses/show', status, view_path: 'app/views', format: :json, scope: rabl_scope.new(receiver)).render Rabl::Renderer.new('api/statuses/show', status, view_path: 'app/views', format: :json, scope: rabl_scope.new(receiver)).render

View file

@ -7,4 +7,4 @@ node(:avatar) { |account| asset_url(account.avatar.url(:large, false))
node(:followers_count) { |account| account.followers.count } node(:followers_count) { |account| account.followers.count }
node(:following_count) { |account| account.following.count } node(:following_count) { |account| account.following.count }
node(:statuses_count) { |account| account.statuses.count } node(:statuses_count) { |account| account.statuses.count }
node(:following) { |account| current_user.account.following?(account) } node(:following) { |account| current_account.following?(account) }

View file

@ -6,8 +6,8 @@ node(:content) { |status| content_for_status(status) }
node(:url) { |status| url_for_target(status) } node(:url) { |status| url_for_target(status) }
node(:reblogs_count) { |status| status.reblogs_count } node(:reblogs_count) { |status| status.reblogs_count }
node(:favourites_count) { |status| status.favourites_count } node(:favourites_count) { |status| status.favourites_count }
node(:favourited) { |status| current_user.account.favourited?(status) } node(:favourited) { |status| current_account.favourited?(status) }
node(:reblogged) { |status| current_user.account.reblogged?(status) } node(:reblogged) { |status| current_account.reblogged?(status) }
child :reblog => :reblog do child :reblog => :reblog do
extends('api/statuses/show') extends('api/statuses/show')

View file

@ -1,6 +1,6 @@
default: &default default: &default
adapter: postgresql adapter: postgresql
pool: 15 pool: 17
timeout: 5000 timeout: 5000
encoding: unicode encoding: unicode

View file

@ -1,2 +1,4 @@
Rails.application.middleware.swap(Rack::Deflater, Rack::MiniProfiler) unless Rails.env == 'test'
Rails.application.middleware.swap(Rack::MiniProfiler, Rack::Deflater) Rails.application.middleware.swap(Rack::Deflater, Rack::MiniProfiler)
Rails.application.middleware.swap(Rack::MiniProfiler, Rack::Deflater)
end