diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-01 09:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-01 09:09:45 +0300 |
commit | 533ef6532ae5499b8ff2f886cbc677844c7b82e1 (patch) | |
tree | 26fdc7ca683c23bc2bc940b23fc3f11ded05fcae /spec/support_specs/database | |
parent | 7658b09b49ce4abfc402682d446ce263017f3a57 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support_specs/database')
-rw-r--r-- | spec/support_specs/database/prevent_cross_joins_spec.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/support_specs/database/prevent_cross_joins_spec.rb b/spec/support_specs/database/prevent_cross_joins_spec.rb index e9a95fe77a5..0fbcd190c2c 100644 --- a/spec/support_specs/database/prevent_cross_joins_spec.rb +++ b/spec/support_specs/database/prevent_cross_joins_spec.rb @@ -22,6 +22,12 @@ RSpec.describe Database::PreventCrossJoins do described_class::CrossJoinAcrossUnsupportedTablesError) end + context 'when annotation is used' do + it 'does not raise exception' do + expect { main_and_ci_allowed_via_annotate }.not_to raise_error + end + end + context 'when allow_cross_joins_across_databases is used' do it 'does not raise exception' do expect { main_and_ci_query_allowlisted }.not_to raise_error @@ -52,6 +58,12 @@ RSpec.describe Database::PreventCrossJoins do end end + def main_and_ci_allowed_via_annotate + main_and_ci_query do |relation| + relation.allow_cross_joins_across_databases(url: 'http://issue-url') + end + end + def main_only_query Issue.joins(:project).last end @@ -61,6 +73,8 @@ RSpec.describe Database::PreventCrossJoins do end def main_and_ci_query - Ci::Build.joins(:project).last + relation = Ci::Build.joins(:project) + relation = yield(relation) if block_given? + relation.last end end |