diff options
author | Semyon Pupkov <mail@semyonpupkov.com> | 2018-03-04 18:53:51 +0100 |
---|---|---|
committer | Semyon Pupkov <mail@semyonpupkov.com> | 2018-03-05 19:57:45 +0100 |
commit | e4558010ac28cb80af3457044f82c5ccfa8ff71f (patch) | |
tree | 67011bae0053ec233fdeafa6a3e9a261f8143c25 /spec/features | |
parent | 8a0052c037f025b64159ca8cfe0d3451261c1edb (diff) | |
download | gitlab-ce-e4558010ac28cb80af3457044f82c5ccfa8ff71f.tar.gz |
Move project fork spinach tests to RSpec
https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/fork_spec.rb | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/spec/features/projects/fork_spec.rb b/spec/features/projects/fork_spec.rb index 842840cc04c..1743b1e083f 100644 --- a/spec/features/projects/fork_spec.rb +++ b/spec/features/projects/fork_spec.rb @@ -25,6 +25,110 @@ describe 'Project fork' do expect(page).to have_css('a.disabled', text: 'Fork') end + it 'forks the project' do + visit project_path(project) + + click_link 'Fork' + + page.within '.fork-thumbnail-container' do + click_link user.name + end + + expect(page).to have_content 'Forked from' + + visit project_path(project) + + expect(page).to have_content(/new merge request/i) + + page.within '.nav-sidebar' do + first(:link, 'Merge Requests').click + end + + expect(page).to have_content(/new merge request/i) + + page.within '#content-body' do + click_link('New merge request') + end + + expect(current_path).to have_content(/#{user.namespace.name}/i) + end + + it 'shows the forked project on the list' do + visit project_path(project) + + click_link 'Fork' + + page.within '.fork-thumbnail-container' do + click_link user.name + end + + visit project_forks_path(project) + + forked_project = user.fork_of(project.reload) + + page.within('.js-projects-list-holder') do + expect(page).to have_content("#{forked_project.namespace.human_name} / #{forked_project.name}") + end + + forked_project.update!(path: 'test-crappy-path') + + visit project_forks_path(project) + + page.within('.js-projects-list-holder') do + expect(page).to have_content("#{forked_project.namespace.human_name} / #{forked_project.name}") + end + end + + context 'when the project is private' do + let(:project) { create(:project, :repository) } + let(:another_user) { create(:user, name: 'Mike') } + + before do + project.add_reporter(user) + project.add_reporter(another_user) + end + + it 'renders private forks of the project' do + visit project_path(project) + + another_project_fork = Projects::ForkService.new(project, another_user).execute + + click_link 'Fork' + + page.within '.fork-thumbnail-container' do + click_link user.name + end + + visit project_forks_path(project) + + page.within('.js-projects-list-holder') do + user_project_fork = user.fork_of(project.reload) + expect(page).to have_content("#{user_project_fork.namespace.human_name} / #{user_project_fork.name}") + end + + expect(page).not_to have_content("#{another_project_fork.namespace.human_name} / #{another_project_fork.name}") + expect(page).to have_content("1 private fork") + end + end + + context 'when the user already forked the project' do + before do + create(:project, :repository, name: project.name, namespace: user.namespace) + end + + it 'renders error' do + visit project_path(project) + + click_link 'Fork' + + page.within '.fork-thumbnail-container' do + click_link user.name + end + + expect(page).to have_content "Name has already been taken" + end + end + context 'master in group' do let(:group) { create(:group) } |