summaryrefslogtreecommitdiff
path: root/features/steps/project/project_fork.rb
blob: 858c7d11b32ff1fe0f3e80ea0393015bcfb40527 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class ForkProject < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedPaths
  include SharedProject

  step 'I click link "Fork"' do
    page.should have_content "Shop"
    page.should have_content "Fork"
    Gitlab::Shell.any_instance.stub(:fork_repository).and_return(true)
    click_link "Fork"
  end

  step 'I am a member of project "Shop"' do
    @project = Project.find_by_name "Shop"
    @project ||= create(:project_with_code, name: "Shop", group: create(:group))
    @project.team << [@user, :reporter]
  end

  step 'I should see the forked project page' do
    page.should have_content "Project was successfully forked."
    current_path.should include current_user.namespace.path
    @forked_project = Project.find_by_namespace_id(current_user.namespace.path)
  end

  step 'I already have a project named "Shop" in my namespace' do
    current_user.namespace ||= create(:namespace)
    current_user.namespace.should_not be_nil
    current_user.namespace.path.should_not be_nil
    @my_project = create(:project_with_code, name: "Shop", namespace: current_user.namespace)
  end

  step 'I should see a "Name has already been taken" warning' do
    page.should have_content "Name has already been taken"
  end

end