2017-04-05 08:43:03 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature 'Groups Merge Requests Empty States' do
|
|
|
|
let(:group) { create(:group) }
|
|
|
|
let(:user) { create(:group_member, :developer, user: create(:user), group: group ).user }
|
|
|
|
|
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2017-04-05 08:43:03 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'group has a project' do
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, namespace: group) }
|
2017-04-05 08:43:03 -04:00
|
|
|
|
|
|
|
before do
|
|
|
|
project.add_master(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'the project has a merge request' do
|
|
|
|
before do
|
|
|
|
create(:merge_request, source_project: project)
|
|
|
|
|
|
|
|
visit merge_requests_group_path(group)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not display an empty state' do
|
|
|
|
expect(page).not_to have_selector('.empty-state')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'the project has no merge requests', :js do
|
|
|
|
before do
|
|
|
|
visit merge_requests_group_path(group)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should display an empty state' do
|
|
|
|
expect(page).to have_selector('.empty-state')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should show a new merge request button' do
|
|
|
|
within '.empty-state' do
|
2017-08-07 16:55:50 -04:00
|
|
|
expect(page).to have_content('create merge request')
|
2017-04-05 08:43:03 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'the new merge request button opens a project dropdown' do
|
|
|
|
within '.empty-state' do
|
|
|
|
find('.new-project-item-select-button').click
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_selector('.ajax-project-dropdown')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'group without a project' do
|
|
|
|
before do
|
|
|
|
visit merge_requests_group_path(group)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should display an empty state' do
|
|
|
|
expect(page).to have_selector('.empty-state')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not show a new merge request button' do
|
|
|
|
within '.empty-state' do
|
2017-08-07 16:55:50 -04:00
|
|
|
expect(page).not_to have_link('create merge request')
|
2017-04-05 08:43:03 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|