diff options
author | mhasbini <mohammad.hasbini@gmail.com> | 2017-04-04 13:54:58 +0300 |
---|---|---|
committer | mhasbini <mohammad.hasbini@gmail.com> | 2017-04-04 13:54:58 +0300 |
commit | e52b1df1d5391f0fa0b9ec7eb2d3492b05f64ba4 (patch) | |
tree | c9fbd2c57dae0a5872653d3df0b9a681a5441404 /spec/support/issuables_list_metadata_shared_examples.rb | |
parent | 9fc17f6f4abdb04f3cf1b60b87bd67b894a19c39 (diff) |
Remove useless queries with false conditions (e.g 1=0)
Diffstat (limited to 'spec/support/issuables_list_metadata_shared_examples.rb')
-rw-r--r-- | spec/support/issuables_list_metadata_shared_examples.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/support/issuables_list_metadata_shared_examples.rb b/spec/support/issuables_list_metadata_shared_examples.rb index 4c0f556e736..e1ac8fd60cd 100644 --- a/spec/support/issuables_list_metadata_shared_examples.rb +++ b/spec/support/issuables_list_metadata_shared_examples.rb @@ -33,4 +33,19 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil| expect(meta_data[id].upvotes).to eq(id + 2) end end + + describe "when given empty collection" do + let(:project2) { create(:empty_project, :public) } + + it "doesn't execute any queries with false conditions" do + get_action = + if action + proc { get action } + else + proc { get :index, namespace_id: project2.namespace, project_id: project2 } + end + + expect(&get_action).not_to make_queries_matching(/WHERE (?:1=0|0=1)/) + end + end end |