summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2018-04-18 19:02:04 +0000
committerRobert Speicher <rspeicher@gmail.com>2018-04-18 14:16:41 -0500
commitcd47325959b00a0f6cf38ad1fcfcf1a4400c16b8 (patch)
treed825cb16ef2292752d5150fe2d905ea5100988a3 /spec
parent8815f0f70502e68532a7055db2de50699f63e65a (diff)
downloadgitlab-ce-cd47325959b00a0f6cf38ad1fcfcf1a4400c16b8.tar.gz
Merge branch 'revert-goldiloader' into 'master'
Revert the addition of goldiloader See merge request gitlab-org/gitlab-ce!18458 (cherry picked from commit aa2bb207560e06d81ae4fcf07ee4bb86dfa862a1)
Diffstat (limited to 'spec')
-rw-r--r--spec/rubocop/cop/gitlab/has_many_through_scope_spec.rb74
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