2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 07:56:52 +00:00
|
|
|
require 'spec_helper'
|
2017-08-01 18:03:07 +00:00
|
|
|
|
2020-06-16 18:09:01 +00:00
|
|
|
RSpec.describe 'Merge request > User sees empty state' do
|
2017-08-01 18:03:07 +00:00
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
let(:user) { project.creator }
|
|
|
|
|
|
|
|
before do
|
2018-07-11 14:36:08 +00:00
|
|
|
project.add_maintainer(user)
|
2017-08-01 18:03:07 +00:00
|
|
|
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
|
2018-11-08 11:54:05 +00:00
|
|
|
visit project_merge_requests_path(project)
|
|
|
|
|
2017-08-01 18:03:07 +00:00
|
|
|
expect(page).not_to have_selector('.empty-state')
|
|
|
|
end
|
2018-11-08 11:54:05 +00:00
|
|
|
|
|
|
|
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')
|
2018-11-19 13:24:15 +00:00
|
|
|
expect(page).to have_content('To widen your search, change or remove filters above')
|
2018-11-08 11:54:05 +00:00
|
|
|
end
|
2017-08-01 18:03:07 +00:00
|
|
|
end
|
|
|
|
end
|