Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-03-15 18:46:17 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2016-03-15 18:46:17 +0300
commitc742760289e51117d3e76e27a626691bec631e1e (patch)
treecb807ba4c3dc6da80ac3b4650654a8b2ba53ab6a /spec
parentea7d062fa60e3e622288237fc66a815348bbcf36 (diff)
Ignore eager loading in Project.search UNION
The queries that are UNION'd together don't need any eager loading (since we really only use the resulting SQL instead of having ActiveRecord actually run the queries). By dropping any eager loaded associations queries such as the following work instead of producing a SQL error: Project.all.includes(:namespace).search('foo')
Diffstat (limited to 'spec')
-rw-r--r--spec/models/project_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 59c5ffa6b9c..b8b9a455b83 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -634,6 +634,12 @@ describe Project, models: true do
it 'returns projects with a matching namespace name regardless of the casing' do
expect(described_class.search(project.namespace.name.upcase)).to eq([project])
end
+
+ it 'returns projects when eager loading namespaces' do
+ relation = described_class.all.includes(:namespace)
+
+ expect(relation.search(project.namespace.name)).to eq([project])
+ end
end
describe '#rename_repo' do