Commit 6ac12241 authored by Eugenia Grieff's avatar Eugenia Grieff

Revert to use merge requests count for group view

- We should not use the variable @merge_requests
in this condition because it only considers open
merge requests and it is recalculated if filters
are present

Changelog: fixed
parent 5f711ce0
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- page_title _("Merge requests") - page_title _("Merge requests")
- if @merge_requests&.size == 0 - if issuables_count_for_state(:merge_requests, :all) == 0
= render 'shared/empty_states/merge_requests', project_select_button: true = render 'shared/empty_states/merge_requests', project_select_button: true
- else - else
.top-area .top-area
......
...@@ -75,4 +75,29 @@ RSpec.describe 'Group merge requests page' do ...@@ -75,4 +75,29 @@ RSpec.describe 'Group merge requests page' do
end end
end end
end end
context 'empty state with no merge requests' do
before do
MergeRequest.delete_all
end
it 'shows an empty state, button to create merge request and no filters bar', :aggregate_failures, :js do
visit path
expect(page).to have_selector('.empty-state')
expect(page).to have_link('Select project to create merge request')
expect(page).not_to have_selector('.issues-filters')
end
context 'with no open merge requests' do
it 'shows an empty state, button to create merge request and filters bar', :aggregate_failures, :js do
create(:merge_request, :closed, source_project: project, target_project: project)
visit path
expect(page).to have_selector('.empty-state')
expect(page).to have_link('Select project to create merge request')
expect(page).to have_selector('.issues-filters')
end
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment