2014-10-02 12:42:54 -04:00
|
|
|
class Spinach::Features::ProjectFork < Spinach::FeatureSteps
|
2013-03-19 11:37:50 -04:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
|
|
|
include SharedProject
|
|
|
|
|
|
|
|
step 'I click link "Fork"' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Shop"
|
2017-06-06 11:05:13 -04:00
|
|
|
click_link "Fork"
|
2013-03-19 11:37:50 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I am a member of project "Shop"' do
|
2017-01-16 23:09:57 -05:00
|
|
|
@project = create(:project, :repository, name: "Shop")
|
2013-03-19 11:37:50 -04:00
|
|
|
@project.team << [@user, :reporter]
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see the forked project page' do
|
2015-09-01 03:56:40 -04:00
|
|
|
expect(page).to have_content "Forked from"
|
2013-03-19 11:37:50 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I already have a project named "Shop" in my namespace' do
|
2017-01-16 23:09:57 -05:00
|
|
|
@my_project = create(:project, :repository, name: "Shop", namespace: current_user.namespace)
|
2013-03-19 11:37:50 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see a "Name has already been taken" warning' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Name has already been taken"
|
2013-03-19 11:37:50 -04:00
|
|
|
end
|
2014-11-14 09:06:39 -05:00
|
|
|
|
|
|
|
step 'I fork to my namespace' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.fork-namespaces' do
|
2014-11-14 09:06:39 -05:00
|
|
|
click_link current_user.name
|
|
|
|
end
|
|
|
|
end
|
2015-12-23 10:20:07 -05:00
|
|
|
|
2015-12-25 11:30:48 -05:00
|
|
|
step 'I should see "New merge request"' do
|
|
|
|
expect(page).to have_content(/new merge request/i)
|
2015-12-23 10:20:07 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I goto the Merge Requests page' do
|
2017-08-30 07:33:06 -04:00
|
|
|
page.within '.nav-sidebar' do
|
2015-12-23 10:20:07 -05:00
|
|
|
click_link "Merge Requests"
|
|
|
|
end
|
|
|
|
end
|
2015-12-25 11:30:48 -05:00
|
|
|
|
|
|
|
step 'I click link "New merge request"' do
|
2017-05-26 11:59:45 -04:00
|
|
|
page.within '#content-body' do
|
|
|
|
page.has_link?('New Merge Request') ? click_link("New Merge Request") : click_link('New merge request')
|
|
|
|
end
|
2015-12-25 11:30:48 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see the new merge request page for my namespace' do
|
|
|
|
current_path.should have_content(/#{current_user.namespace.name}/i)
|
|
|
|
end
|
2016-01-15 12:35:25 -05:00
|
|
|
|
|
|
|
step 'I visit the forks page of the "Shop" project' do
|
|
|
|
@project = Project.where(name: 'Shop').last
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_forks_path(@project)
|
2016-01-15 12:35:25 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see my fork on the list' do
|
2017-03-03 05:13:03 -05:00
|
|
|
page.within('.js-projects-list-holder') do
|
2016-01-15 12:35:25 -05:00
|
|
|
project = @user.fork_of(@project)
|
|
|
|
expect(page).to have_content("#{project.namespace.human_name} / #{project.name}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-02-16 10:40:36 -05:00
|
|
|
step 'I make forked repo invalid' do
|
|
|
|
project = @user.fork_of(@project)
|
|
|
|
project.path = 'test-crappy-path'
|
|
|
|
project.save!
|
|
|
|
end
|
|
|
|
|
2016-01-15 12:35:25 -05:00
|
|
|
step 'There is an existent fork of the "Shop" project' do
|
|
|
|
user = create(:user, name: 'Mike')
|
2016-09-19 14:28:41 -04:00
|
|
|
@project.team << [user, :reporter]
|
2016-01-15 12:35:25 -05:00
|
|
|
@forked_project = Projects::ForkService.new(@project, user).execute
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see the other fork listed' do
|
|
|
|
expect(page).not_to have_content("#{@forked_project.namespace.human_name} / #{@forked_project.name}")
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see a private fork notice' do
|
|
|
|
expect(page).to have_content("1 private fork")
|
|
|
|
end
|
2013-06-22 11:57:34 -04:00
|
|
|
end
|