debian-mirror-gitlab/features/steps/project/fork.rb

86 lines
2.5 KiB
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
class Spinach::Features::ProjectFork < Spinach::FeatureSteps
2014-09-02 18:07:02 +05:30
include SharedAuthentication
include SharedPaths
include SharedProject
step 'I click link "Fork"' do
2015-09-11 14:41:01 +05:30
expect(page).to have_content "Shop"
2017-09-10 17:25:29 +05:30
click_link "Fork"
2014-09-02 18:07:02 +05:30
end
step 'I am a member of project "Shop"' do
2017-08-17 22:00:37 +05:30
@project = create(:project, :repository, name: "Shop")
2018-03-17 18:26:18 +05:30
@project.add_reporter(@user)
2014-09-02 18:07:02 +05:30
end
step 'I should see the forked project page' do
2015-09-25 12:07:36 +05:30
expect(page).to have_content "Forked from"
2014-09-02 18:07:02 +05:30
end
step 'I already have a project named "Shop" in my namespace' do
2017-08-17 22:00:37 +05:30
@my_project = create(:project, :repository, name: "Shop", namespace: current_user.namespace)
2014-09-02 18:07:02 +05:30
end
step 'I should see a "Name has already been taken" warning' do
2015-09-11 14:41:01 +05:30
expect(page).to have_content "Name has already been taken"
2014-09-02 18:07:02 +05:30
end
2015-04-26 12:48:37 +05:30
step 'I fork to my namespace' do
2018-03-17 18:26:18 +05:30
page.within '.fork-thumbnail-container' do
2015-04-26 12:48:37 +05:30
click_link current_user.name
end
end
step 'I should see "New merge request"' do
expect(page).to have_content(/new merge request/i)
end
step 'I goto the Merge Requests page' do
2018-03-17 18:26:18 +05:30
page.within '.nav-sidebar' do
first(:link, "Merge Requests").click
end
end
step 'I click link "New merge request"' do
2017-09-10 17:25:29 +05:30
page.within '#content-body' do
page.has_link?('New Merge Request') ? click_link("New Merge Request") : click_link('New merge request')
end
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-04-02 18:10:28 +05:30
step 'I visit the forks page of the "Shop" project' do
2018-03-17 18:26:18 +05:30
@project = Project.where(name: 'Shop').first
2017-09-10 17:25:29 +05:30
visit project_forks_path(@project)
2016-04-02 18:10:28 +05:30
end
step 'I should see my fork on the list' do
2017-08-17 22:00:37 +05:30
page.within('.js-projects-list-holder') do
2018-03-17 18:26:18 +05:30
project = @user.fork_of(@project.reload)
2016-04-02 18:10:28 +05:30
expect(page).to have_content("#{project.namespace.human_name} / #{project.name}")
end
end
step 'I make forked repo invalid' do
2018-03-17 18:26:18 +05:30
project = @user.fork_of(@project.reload)
2016-04-02 18:10:28 +05:30
project.path = 'test-crappy-path'
project.save!
end
step 'There is an existent fork of the "Shop" project' do
user = create(:user, name: 'Mike')
2018-03-17 18:26:18 +05:30
@project.add_reporter(user)
2016-04-02 18:10:28 +05:30
@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
2014-09-02 18:07:02 +05:30
end