diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-04-18 15:41:42 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-04-18 15:51:39 +0200 |
commit | 6f292eaa69c771cec8a81d2edaad19a26ab3eae6 (patch) | |
tree | 30ef0c062121834b2dca4f4a87bc7af72e071962 /spec/rubocop | |
parent | 019c0d5761b55ca21fd71d547dd4a2ebf14d615f (diff) | |
download | gitlab-ce-6f292eaa69c771cec8a81d2edaad19a26ab3eae6.tar.gz |
Revert the addition of goldiloader
This reverts the addition of the "goldiloader" Gem and all use of it.
While this Gem is very promising it's causing a variety of problems on
GitLab.com due to it eager-loading too much data in places where we
don't expect/can handle this. At least for the time being this means we
have to go back to manually fixing N+1 query problems, but at least
those should not cause a negative impact on availability.
Diffstat (limited to 'spec/rubocop')
-rw-r--r-- | spec/rubocop/cop/gitlab/has_many_through_scope_spec.rb | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/spec/rubocop/cop/gitlab/has_many_through_scope_spec.rb b/spec/rubocop/cop/gitlab/has_many_through_scope_spec.rb deleted file mode 100644 index 6d769c8e6fd..00000000000 --- a/spec/rubocop/cop/gitlab/has_many_through_scope_spec.rb +++ /dev/null @@ -1,74 +0,0 @@ -require 'spec_helper' - -require 'rubocop' -require 'rubocop/rspec/support' - -require_relative '../../../../rubocop/cop/gitlab/has_many_through_scope' - -describe RuboCop::Cop::Gitlab::HasManyThroughScope do # rubocop:disable RSpec/FilePath - include CopHelper - - subject(:cop) { described_class.new } - - context 'in a model file' do - before do - allow(cop).to receive(:in_model?).and_return(true) - end - - context 'when the model does not use has_many :through' do - it 'does not register an offense' do - expect_no_offenses(<<-RUBY) - class User < ActiveRecord::Base - has_many :tags, source: 'UserTag' - end - RUBY - end - end - - context 'when the model uses has_many :through' do - context 'when the association has no scope defined' do - it 'registers an offense on the association' do - expect_offense(<<-RUBY) - class User < ActiveRecord::Base - has_many :tags, through: :user_tags - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #{described_class::MSG} - end - RUBY - end - end - - context 'when the association has a scope defined' do - context 'when the scope does not disable auto-loading' do - it 'registers an offense on the scope' do - expect_offense(<<-RUBY) - class User < ActiveRecord::Base - has_many :tags, -> { where(active: true) }, through: :user_tags - ^^^^^^^^^^^^^^^^^^^^^^^^^^ #{described_class::MSG} - end - RUBY - end - end - - context 'when the scope has auto_include(false)' do - it 'does not register an offense' do - expect_no_offenses(<<-RUBY) - class User < ActiveRecord::Base - has_many :tags, -> { where(active: true).auto_include(false).reorder(nil) }, through: :user_tags - end - RUBY - end - end - end - end - end - - context 'outside of a migration spec file' do - it 'does not register an offense' do - expect_no_offenses(<<-RUBY) - class User < ActiveRecord::Base - has_many :tags, through: :user_tags - end - RUBY - end - end -end |