From ce9df2fa8295a3bdd0da583ba5d0d90251e1d448 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 4 Apr 2017 13:01:14 +0200 Subject: Optimize filter methods in FeedManager a bit, use redis pipelining on merge/unmerge feed methods, do not re-create a dynamic class on each feed push call, make sure redis-rb uses hiredis --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Gemfile') diff --git a/Gemfile b/Gemfile index 46baed307..cb9824131 100644 --- a/Gemfile +++ b/Gemfile @@ -38,7 +38,7 @@ gem 'rqrcode' gem 'twitter-text' gem 'oj' gem 'hiredis' -gem 'redis', '~>3.2' +gem 'redis', '~>3.2', require: ['redis', 'redis/connection/hiredis'] gem 'fast_blank' gem 'htmlentities' gem 'simple_form' -- cgit From 82aaedec467815c2947a11651d5216bb88ce4038 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 4 Apr 2017 13:58:34 +0200 Subject: Reduce number of items in feeds, optimize regeneration worker slightly, make regeneration worker unique, (only schedule/execute once at a time) --- Gemfile | 2 ++ Gemfile.lock | 9 +++++++++ app/lib/feed_manager.rb | 6 +++--- app/services/precompute_feed_service.rb | 8 +++++--- app/workers/regeneration_worker.rb | 2 +- 5 files changed, 20 insertions(+), 7 deletions(-) (limited to 'Gemfile') diff --git a/Gemfile b/Gemfile index cb9824131..41c636904 100644 --- a/Gemfile +++ b/Gemfile @@ -46,6 +46,8 @@ gem 'will_paginate' gem 'rack-attack' gem 'rack-cors', require: 'rack/cors' gem 'sidekiq' +gem 'sidekiq-unique-jobs' +gem 'sidekiq-merger' gem 'rails-settings-cached' gem 'simple-navigation' gem 'statsd-instrument' diff --git a/Gemfile.lock b/Gemfile.lock index 6e3115249..27de1bee0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -387,6 +387,13 @@ GEM connection_pool (~> 2.2, >= 2.2.0) rack-protection (>= 1.5.0) redis (~> 3.2, >= 3.2.1) + sidekiq-merger (0.0.11) + activesupport (>= 3.2, < 6) + concurrent-ruby (~> 1.0) + sidekiq (>= 3.4, < 5) + sidekiq-unique-jobs (4.0.18) + sidekiq (>= 2.6) + thor simple-navigation (4.0.3) activesupport (>= 2.3.2) simple_form (3.2.1) @@ -510,6 +517,8 @@ DEPENDENCIES sass-rails (~> 5.0) sdoc (~> 0.4.0) sidekiq + sidekiq-merger + sidekiq-unique-jobs simple-navigation simple_form simplecov diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 919bc3df9..a2efcce10 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -5,7 +5,7 @@ require 'singleton' class FeedManager include Singleton - MAX_ITEMS = 800 + MAX_ITEMS = 400 def key(type, id) "feed:#{type}:#{id}" @@ -50,9 +50,9 @@ class FeedManager def merge_into_timeline(from_account, into_account) timeline_key = key(:home, into_account.id) - query = from_account.statuses.limit(MAX_ITEMS) + query = from_account.statuses.limit(FeedManager::MAX_ITEMS / 4) - if redis.zcard(timeline_key) >= FeedManager::MAX_ITEMS + if redis.zcard(timeline_key) >= FeedManager::MAX_ITEMS / 4 oldest_home_score = redis.zrange(timeline_key, 0, 0, with_scores: true)&.first&.last&.to_i || 0 query = query.where('id > ?', oldest_home_score) end diff --git a/app/services/precompute_feed_service.rb b/app/services/precompute_feed_service.rb index e1ec56e8d..a57c401d0 100644 --- a/app/services/precompute_feed_service.rb +++ b/app/services/precompute_feed_service.rb @@ -5,9 +5,11 @@ class PrecomputeFeedService < BaseService # @param [Symbol] type :home or :mentions # @param [Account] account def call(_, account) - Status.as_home_timeline(account).limit(FeedManager::MAX_ITEMS).each do |status| - next if status.direct_visibility? || FeedManager.instance.filter?(:home, status, account) - redis.zadd(FeedManager.instance.key(:home, account.id), status.id, status.reblog? ? status.reblog_of_id : status.id) + redis.pipelined do + Status.as_home_timeline(account).limit(FeedManager::MAX_ITEMS / 4).each do |status| + next if status.direct_visibility? || FeedManager.instance.filter?(:home, status, account) + redis.zadd(FeedManager.instance.key(:home, account.id), status.id, status.reblog? ? status.reblog_of_id : status.id) + end end end diff --git a/app/workers/regeneration_worker.rb b/app/workers/regeneration_worker.rb index 82665b581..da8b845f6 100644 --- a/app/workers/regeneration_worker.rb +++ b/app/workers/regeneration_worker.rb @@ -3,7 +3,7 @@ class RegenerationWorker include Sidekiq::Worker - sidekiq_options queue: 'pull', backtrace: true + sidekiq_options queue: 'pull', backtrace: true, unique: :until_executed def perform(account_id, _ = :home) PrecomputeFeedService.new.call(:home, Account.find(account_id)) -- cgit From 38b504b7a70c5b100396f36d4c6c6762542984c9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 4 Apr 2017 14:28:57 +0200 Subject: Remove sidekiq-merger --- Gemfile | 1 - Gemfile.lock | 5 ----- 2 files changed, 6 deletions(-) (limited to 'Gemfile') diff --git a/Gemfile b/Gemfile index 41c636904..4c6314763 100644 --- a/Gemfile +++ b/Gemfile @@ -47,7 +47,6 @@ gem 'rack-attack' gem 'rack-cors', require: 'rack/cors' gem 'sidekiq' gem 'sidekiq-unique-jobs' -gem 'sidekiq-merger' gem 'rails-settings-cached' gem 'simple-navigation' gem 'statsd-instrument' diff --git a/Gemfile.lock b/Gemfile.lock index 27de1bee0..26c7b9962 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -387,10 +387,6 @@ GEM connection_pool (~> 2.2, >= 2.2.0) rack-protection (>= 1.5.0) redis (~> 3.2, >= 3.2.1) - sidekiq-merger (0.0.11) - activesupport (>= 3.2, < 6) - concurrent-ruby (~> 1.0) - sidekiq (>= 3.4, < 5) sidekiq-unique-jobs (4.0.18) sidekiq (>= 2.6) thor @@ -517,7 +513,6 @@ DEPENDENCIES sass-rails (~> 5.0) sdoc (~> 0.4.0) sidekiq - sidekiq-merger sidekiq-unique-jobs simple-navigation simple_form -- cgit From 81c76fe375d9342e5a436db05c8e25305c650e8d Mon Sep 17 00:00:00 2001 From: Samy KACIMI Date: Wed, 5 Apr 2017 00:29:56 +0200 Subject: add more tests to models --- Gemfile | 1 + Gemfile.lock | 3 + app/models/block.rb | 5 +- app/models/follow.rb | 9 ++- app/models/follow_request.rb | 5 +- app/models/mention.rb | 5 +- config/database.yml | 4 ++ spec/fabricators/account_fabricator.rb | 2 +- spec/fabricators/block_fabricator.rb | 3 +- spec/fabricators/follow_fabricator.rb | 3 +- spec/fabricators/follow_request_fabricator.rb | 3 +- spec/fabricators/mention_fabricator.rb | 4 ++ spec/fabricators/user_fabricator.rb | 2 +- spec/models/account_spec.rb | 69 ++++++++++++++++++++++ spec/models/block_spec.rb | 17 ++++++ spec/models/domain_block_spec.rb | 18 ++++++ spec/models/follow_request_spec.rb | 19 ++++++ spec/models/follow_spec.rb | 19 ++++++ spec/models/mention_spec.rb | 17 ++++++ spec/models/user_spec.rb | 44 ++++++++++++++ spec/rails_helper.rb | 2 + .../matchers/model/model_have_error_on_field.rb | 15 +++++ 22 files changed, 252 insertions(+), 17 deletions(-) create mode 100644 spec/fabricators/mention_fabricator.rb create mode 100644 spec/support/matchers/model/model_have_error_on_field.rb (limited to 'Gemfile') diff --git a/Gemfile b/Gemfile index 4c6314763..87ea77735 100644 --- a/Gemfile +++ b/Gemfile @@ -70,6 +70,7 @@ group :test do gem 'simplecov', require: false gem 'webmock' gem 'rspec-sidekiq' + gem 'faker' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 26c7b9962..a774a89ba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -149,6 +149,8 @@ GEM erubis (2.7.0) execjs (2.7.0) fabrication (2.15.2) + faker (1.6.6) + i18n (~> 0.5) fast_blank (1.0.0) font-awesome-rails (4.6.3.1) railties (>= 3.2, < 5.1) @@ -470,6 +472,7 @@ DEPENDENCIES doorkeeper dotenv-rails fabrication + faker fast_blank font-awesome-rails fuubar diff --git a/app/models/block.rb b/app/models/block.rb index 9c55703c9..ae456a6b6 100644 --- a/app/models/block.rb +++ b/app/models/block.rb @@ -3,9 +3,8 @@ class Block < ApplicationRecord include Paginable - belongs_to :account - belongs_to :target_account, class_name: 'Account' + belongs_to :account, required: true + belongs_to :target_account, class_name: 'Account', required: true - validates :account, :target_account, presence: true validates :account_id, uniqueness: { scope: :target_account_id } end diff --git a/app/models/follow.rb b/app/models/follow.rb index 8bfe8b2f6..fd7325f05 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -3,11 +3,14 @@ class Follow < ApplicationRecord include Paginable - belongs_to :account, counter_cache: :following_count - belongs_to :target_account, class_name: 'Account', counter_cache: :followers_count + belongs_to :account, counter_cache: :following_count, required: true + + belongs_to :target_account, + class_name: 'Account', + counter_cache: :followers_count, + required: true has_one :notification, as: :activity, dependent: :destroy - validates :account, :target_account, presence: true validates :account_id, uniqueness: { scope: :target_account_id } end diff --git a/app/models/follow_request.rb b/app/models/follow_request.rb index 4224ab15d..20e1332dd 100644 --- a/app/models/follow_request.rb +++ b/app/models/follow_request.rb @@ -3,12 +3,11 @@ class FollowRequest < ApplicationRecord include Paginable - belongs_to :account - belongs_to :target_account, class_name: 'Account' + belongs_to :account, required: true + belongs_to :target_account, class_name: 'Account', required: true has_one :notification, as: :activity, dependent: :destroy - validates :account, :target_account, presence: true validates :account_id, uniqueness: { scope: :target_account_id } def authorize! diff --git a/app/models/mention.rb b/app/models/mention.rb index 10a9cb1cd..03e76fcc4 100644 --- a/app/models/mention.rb +++ b/app/models/mention.rb @@ -1,11 +1,10 @@ # frozen_string_literal: true class Mention < ApplicationRecord - belongs_to :account, inverse_of: :mentions - belongs_to :status + belongs_to :account, inverse_of: :mentions, required: true + belongs_to :status, required: true has_one :notification, as: :activity, dependent: :destroy - validates :account, :status, presence: true validates :account, uniqueness: { scope: :status } end diff --git a/config/database.yml b/config/database.yml index 5ec342f93..390113480 100644 --- a/config/database.yml +++ b/config/database.yml @@ -3,6 +3,10 @@ default: &default pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %> timeout: 5000 encoding: unicode + host: localhost + username: samy + password: tardis + port: 32769 development: <<: *default diff --git a/spec/fabricators/account_fabricator.rb b/spec/fabricators/account_fabricator.rb index 3a7c00bf5..567de05f4 100644 --- a/spec/fabricators/account_fabricator.rb +++ b/spec/fabricators/account_fabricator.rb @@ -1,3 +1,3 @@ Fabricator(:account) do - username "alice" + username { Faker::Internet.user_name(nil, %w(_)) } end diff --git a/spec/fabricators/block_fabricator.rb b/spec/fabricators/block_fabricator.rb index 9a5a6808f..379931ba6 100644 --- a/spec/fabricators/block_fabricator.rb +++ b/spec/fabricators/block_fabricator.rb @@ -1,3 +1,4 @@ Fabricator(:block) do - + account + target_account { Fabricate(:account) } end diff --git a/spec/fabricators/follow_fabricator.rb b/spec/fabricators/follow_fabricator.rb index 9d9d06f12..9b25dc547 100644 --- a/spec/fabricators/follow_fabricator.rb +++ b/spec/fabricators/follow_fabricator.rb @@ -1,3 +1,4 @@ Fabricator(:follow) do - + account + target_account { Fabricate(:account) } end diff --git a/spec/fabricators/follow_request_fabricator.rb b/spec/fabricators/follow_request_fabricator.rb index 9c3733cef..78a057919 100644 --- a/spec/fabricators/follow_request_fabricator.rb +++ b/spec/fabricators/follow_request_fabricator.rb @@ -1,3 +1,4 @@ Fabricator(:follow_request) do - + account + target_account { Fabricate(:account) } end diff --git a/spec/fabricators/mention_fabricator.rb b/spec/fabricators/mention_fabricator.rb new file mode 100644 index 000000000..cb5fe4299 --- /dev/null +++ b/spec/fabricators/mention_fabricator.rb @@ -0,0 +1,4 @@ +Fabricator(:mention) do + account + status +end diff --git a/spec/fabricators/user_fabricator.rb b/spec/fabricators/user_fabricator.rb index c08559137..16b3b1f6f 100644 --- a/spec/fabricators/user_fabricator.rb +++ b/spec/fabricators/user_fabricator.rb @@ -1,6 +1,6 @@ Fabricator(:user) do account - email "alice@example.com" + email { Faker::Internet.email } password "123456789" confirmed_at { Time.now } end diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index 91c8d75cf..fbc9a7d40 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -209,4 +209,73 @@ RSpec.describe Account, type: :model do expect(subject.match('Check this out https://medium.com/@alice/some-article#.abcdef123')).to be_nil end end + + describe 'validations' do + it 'has a valid fabricator' do + account = Fabricate.build(:account) + account.valid? + expect(account).to be_valid + end + + it 'is invalid without a username' do + account = Fabricate.build(:account, username: nil) + account.valid? + expect(account).to model_have_error_on_field(:username) + end + + it 'is invalid is the username already exists' do + account_1 = Fabricate(:account, username: 'the_doctor') + account_2 = Fabricate.build(:account, username: 'the_doctor') + account_2.valid? + expect(account_2).to model_have_error_on_field(:username) + end + + context 'when is local' do + it 'is invalid if the username doesn\'t only contains letters, numbers and underscores' do + account = Fabricate.build(:account, username: 'the-doctor') + account.valid? + expect(account).to model_have_error_on_field(:username) + end + + it 'is invalid if the username is longer then 30 characters' do + account = Fabricate.build(:account, username: Faker::Lorem.characters(31)) + account.valid? + expect(account).to model_have_error_on_field(:username) + end + end + end + + describe 'scopes' do + describe 'remote' do + it 'returns an array of accounts who have a domain' do + account_1 = Fabricate(:account, domain: nil) + account_2 = Fabricate(:account, domain: 'example.com') + expect(Account.remote).to match_array([account_2]) + end + end + + describe 'local' do + it 'returns an array of accounts who do not have a domain' do + account_1 = Fabricate(:account, domain: nil) + account_2 = Fabricate(:account, domain: 'example.com') + expect(Account.local).to match_array([account_1]) + end + end + + describe 'silenced' do + it 'returns an array of accounts who are silenced' do + account_1 = Fabricate(:account, silenced: true) + account_2 = Fabricate(:account, silenced: false) + expect(Account.silenced).to match_array([account_1]) + end + end + + describe 'suspended' do + it 'returns an array of accounts who are suspended' do + account_1 = Fabricate(:account, suspended: true) + account_2 = Fabricate(:account, suspended: false) + expect(Account.suspended).to match_array([account_1]) + end + end + end end diff --git a/spec/models/block_spec.rb b/spec/models/block_spec.rb index 6862de6fc..cabb41c3e 100644 --- a/spec/models/block_spec.rb +++ b/spec/models/block_spec.rb @@ -1,5 +1,22 @@ require 'rails_helper' RSpec.describe Block, type: :model do + describe 'validations' do + it 'has a valid fabricator' do + block = Fabricate.build(:block) + expect(block).to be_valid + end + it 'is invalid without an account' do + block = Fabricate.build(:block, account: nil) + block.valid? + expect(block).to model_have_error_on_field(:account) + end + + it 'is invalid without a target_account' do + block = Fabricate.build(:block, target_account: nil) + block.valid? + expect(block).to model_have_error_on_field(:target_account) + end + end end diff --git a/spec/models/domain_block_spec.rb b/spec/models/domain_block_spec.rb index ad5403110..b19c8083e 100644 --- a/spec/models/domain_block_spec.rb +++ b/spec/models/domain_block_spec.rb @@ -1,5 +1,23 @@ require 'rails_helper' RSpec.describe DomainBlock, type: :model do + describe 'validations' do + it 'has a valid fabricator' do + domain_block = Fabricate.build(:domain_block) + expect(domain_block).to be_valid + end + it 'is invalid without a domain' do + domain_block = Fabricate.build(:domain_block, domain: nil) + domain_block.valid? + expect(domain_block).to model_have_error_on_field(:domain) + end + + it 'is invalid if the domain already exists' do + domain_block_1 = Fabricate(:domain_block, domain: 'dalek.com') + domain_block_2 = Fabricate.build(:domain_block, domain: 'dalek.com') + domain_block_2.valid? + expect(domain_block_2).to model_have_error_on_field(:domain) + end + end end diff --git a/spec/models/follow_request_spec.rb b/spec/models/follow_request_spec.rb index f2ec642d8..cc6f8ee62 100644 --- a/spec/models/follow_request_spec.rb +++ b/spec/models/follow_request_spec.rb @@ -3,4 +3,23 @@ require 'rails_helper' RSpec.describe FollowRequest, type: :model do describe '#authorize!' describe '#reject!' + + describe 'validations' do + it 'has a valid fabricator' do + follow_request = Fabricate.build(:follow_request) + expect(follow_request).to be_valid + end + + it 'is invalid without an account' do + follow_request = Fabricate.build(:follow_request, account: nil) + follow_request.valid? + expect(follow_request).to model_have_error_on_field(:account) + end + + it 'is invalid without a target account' do + follow_request = Fabricate.build(:follow_request, target_account: nil) + follow_request.valid? + expect(follow_request).to model_have_error_on_field(:target_account) + end + end end diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb index eb21f3e18..0fae25352 100644 --- a/spec/models/follow_spec.rb +++ b/spec/models/follow_spec.rb @@ -5,4 +5,23 @@ RSpec.describe Follow, type: :model do let(:bob) { Fabricate(:account, username: 'bob') } subject { Follow.new(account: alice, target_account: bob) } + + describe 'validations' do + it 'has a valid fabricator' do + follow = Fabricate.build(:follow) + expect(follow).to be_valid + end + + it 'is invalid without an account' do + follow = Fabricate.build(:follow, account: nil) + follow.valid? + expect(follow).to model_have_error_on_field(:account) + end + + it 'is invalid without a target_account' do + follow = Fabricate.build(:follow, target_account: nil) + follow.valid? + expect(follow).to model_have_error_on_field(:target_account) + end + end end diff --git a/spec/models/mention_spec.rb b/spec/models/mention_spec.rb index 5c91fda02..dbcf6a32c 100644 --- a/spec/models/mention_spec.rb +++ b/spec/models/mention_spec.rb @@ -1,5 +1,22 @@ require 'rails_helper' RSpec.describe Mention, type: :model do + describe 'validations' do + it 'has a valid fabricator' do + mention = Fabricate.build(:mention) + expect(mention).to be_valid + end + it 'is invalid without an account' do + mention = Fabricate.build(:mention, account: nil) + mention.valid? + expect(mention).to model_have_error_on_field(:account) + end + + it 'is invalid without a status' do + mention = Fabricate.build(:mention, status: nil) + mention.valid? + expect(mention).to model_have_error_on_field(:status) + end + end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 64de06749..1a3254185 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,5 +1,49 @@ require 'rails_helper' RSpec.describe User, type: :model do + describe 'validations' do + it 'is invalid without an account' do + user = Fabricate.build(:user, account: nil) + user.valid? + expect(user).to model_have_error_on_field(:account) + end + it 'is invalid without a valid locale' do + user = Fabricate.build(:user, locale: 'toto') + user.valid? + expect(user).to model_have_error_on_field(:locale) + end + + it 'is invalid without a valid email' do + user = Fabricate.build(:user, email: 'john@') + user.valid? + expect(user).to model_have_error_on_field(:email) + end + end + + describe 'scopes' do + describe 'recent' do + it 'returns an array of recent users ordered by id' do + user_1 = Fabricate(:user) + user_2 = Fabricate(:user) + expect(User.recent).to match_array([user_2, user_1]) + end + end + + describe 'admins' do + it 'returns an array of users who are admin' do + user_1 = Fabricate(:user, admin: false) + user_2 = Fabricate(:user, admin: true) + expect(User.admins).to match_array([user_2]) + end + end + + 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) + expect(User.confirmed).to match_array([user_2]) + end + end + end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 977c7bdc0..faac96982 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -8,6 +8,8 @@ require 'rspec/rails' require 'webmock/rspec' require 'paperclip/matchers' +Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } + ActiveRecord::Migration.maintain_test_schema! WebMock.disable_net_connect!(allow: 'localhost:7575') Sidekiq::Testing.inline! diff --git a/spec/support/matchers/model/model_have_error_on_field.rb b/spec/support/matchers/model/model_have_error_on_field.rb new file mode 100644 index 000000000..5d5fe1c7b --- /dev/null +++ b/spec/support/matchers/model/model_have_error_on_field.rb @@ -0,0 +1,15 @@ +RSpec::Matchers.define :model_have_error_on_field do |expected| + match do |record| + if record.errors.empty? + record.valid? + end + + record.errors.has_key?(expected) + end + + failure_message do |record| + keys = record.errors.keys + + "expect record.errors(#{keys}) to include #{expected}" + end +end -- cgit From 79ef756f645153b91643765573230814257d0cbf Mon Sep 17 00:00:00 2001 From: Samy KACIMI Date: Wed, 5 Apr 2017 00:47:17 +0200 Subject: fix rubocop issues --- Gemfile | 2 +- app/models/follow.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Gemfile') diff --git a/Gemfile b/Gemfile index 87ea77735..0deed9ae0 100644 --- a/Gemfile +++ b/Gemfile @@ -69,8 +69,8 @@ end group :test do gem 'simplecov', require: false gem 'webmock' - gem 'rspec-sidekiq' gem 'faker' + gem 'rspec-sidekiq' end group :development do diff --git a/app/models/follow.rb b/app/models/follow.rb index fd7325f05..b6b9dca7c 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -4,7 +4,7 @@ class Follow < ApplicationRecord include Paginable belongs_to :account, counter_cache: :following_count, required: true - + belongs_to :target_account, class_name: 'Account', counter_cache: :followers_count, -- cgit From 5af0ecbcd9cfd757c4d5bd541d83ca11e44d14ef Mon Sep 17 00:00:00 2001 From: Samy KACIMI Date: Wed, 5 Apr 2017 00:52:55 +0200 Subject: alphebatically order test gem group as required by rubocop --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Gemfile') diff --git a/Gemfile b/Gemfile index 0deed9ae0..4e7ff6621 100644 --- a/Gemfile +++ b/Gemfile @@ -67,10 +67,10 @@ group :development, :test do end group :test do - gem 'simplecov', require: false - gem 'webmock' gem 'faker' gem 'rspec-sidekiq' + gem 'simplecov', require: false + gem 'webmock' end group :development do -- cgit