diff options
Diffstat (limited to 'spec/support/shared_examples/lib/gitlab/database/cte_materialized_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/lib/gitlab/database/cte_materialized_shared_examples.rb | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/spec/support/shared_examples/lib/gitlab/database/cte_materialized_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/database/cte_materialized_shared_examples.rb index df795723874..b80a51a1fc6 100644 --- a/spec/support/shared_examples/lib/gitlab/database/cte_materialized_shared_examples.rb +++ b/spec/support/shared_examples/lib/gitlab/database/cte_materialized_shared_examples.rb @@ -4,40 +4,17 @@ RSpec.shared_examples 'CTE with MATERIALIZED keyword examples' do describe 'adding MATERIALIZE to the CTE' do let(:options) { {} } - before do - # Clear the cached value before the test - Gitlab::Database::AsWithMaterialized.clear_memoization(:materialized_supported) - end - - context 'when PG version is <12' do - it 'does not add MATERIALIZE keyword' do - allow(ApplicationRecord.database).to receive(:version).and_return('11.1') + it 'adds MATERIALIZE keyword' do + allow(ApplicationRecord.database).to receive(:version).and_return('12.1') - expect(query).to include(expected_query_block_without_materialized) - end + expect(query).to include(expected_query_block_with_materialized) end - context 'when PG version is >=12' do - it 'adds MATERIALIZE keyword' do - allow(ApplicationRecord.database).to receive(:version).and_return('12.1') - - expect(query).to include(expected_query_block_with_materialized) - end + context 'when materialized is disabled' do + let(:options) { { materialized: false } } - context 'when version is higher than 12' do - it 'adds MATERIALIZE keyword' do - allow(ApplicationRecord.database).to receive(:version).and_return('15.1') - - expect(query).to include(expected_query_block_with_materialized) - end - end - - context 'when materialized is disabled' do - let(:options) { { materialized: false } } - - it 'does not add MATERIALIZE keyword' do - expect(query).to include(expected_query_block_without_materialized) - end + it 'does not add MATERIALIZE keyword' do + expect(query).to include(expected_query_block_without_materialized) end end end |