diff options
Diffstat (limited to 'spec/features/merge_requests/user_sees_empty_state_spec.rb')
-rw-r--r-- | spec/features/merge_requests/user_sees_empty_state_spec.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/features/merge_requests/user_sees_empty_state_spec.rb b/spec/features/merge_requests/user_sees_empty_state_spec.rb new file mode 100644 index 00000000000..ac07b31731d --- /dev/null +++ b/spec/features/merge_requests/user_sees_empty_state_spec.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Merge request > User sees empty state' do + let(:project) { create(:project, :public, :repository) } + let(:user) { project.creator } + + before do + project.add_maintainer(user) + sign_in(user) + end + + it 'shows an empty state and a "New merge request" button' do + visit project_merge_requests_path(project) + + expect(page).to have_selector('.empty-state') + expect(page).to have_link 'New merge request', href: project_new_merge_request_path(project) + end + + context 'if there are merge requests' do + before do + create(:merge_request, source_project: project) + end + + it 'does not show an empty state' do + visit project_merge_requests_path(project) + + expect(page).not_to have_selector('.empty-state') + end + + it 'shows empty state when filter results empty' do + visit project_merge_requests_path(project, milestone_title: "1.0") + + expect(page).to have_selector('.empty-state') + expect(page).to have_content('Sorry, your filter produced no results') + expect(page).to have_content('To widen your search, change or remove filters above') + end + end +end |