BigW Consortium Gitlab

projects.rb 4.16 KB
Newer Older
1
class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
2
  include SharedAuthentication
3
  include SharedPaths
4
  include SharedProject
5

6 7 8 9
  step 'I should see project "Empty Public Project"' do
    page.should have_content "Empty Public Project"
  end

10 11 12 13 14 15 16 17 18
  step 'I should see public project details' do
    page.should have_content '32 branches'
    page.should have_content '16 tags'
  end

  step 'I should see project readme' do
    page.should have_content 'README.md'
  end

19
  step 'I should see empty public project details' do
20
    page.should have_content 'Git global setup'
21 22
  end

23
  step 'I should see empty public project details with http clone info' do
skv committed
24
    project = Project.find_by(name: 'Empty Public Project')
25
    all(:css, '.git-empty .clone').each do |element|
26 27 28 29 30
      element.text.should include(project.http_url_to_repo)
    end
  end

  step 'I should see empty public project details with ssh clone info' do
skv committed
31
    project = Project.find_by(name: 'Empty Public Project')
32
    all(:css, '.git-empty .clone').each do |element|
33 34 35 36
      element.text.should include(project.url_to_repo)
    end
  end

37
  step 'I should see project "Community" home page' do
Dmitriy Zaporozhets committed
38
    within '.navbar-gitlab .title' do
Dmitriy Zaporozhets committed
39 40
      page.should have_content 'Community'
    end
41 42
  end

43
  step 'I should see project "Internal" home page' do
Dmitriy Zaporozhets committed
44
    within '.navbar-gitlab .title' do
45 46
      page.should have_content 'Internal'
    end
47
  end
48

49
  step 'I should see an http link to the repository' do
skv committed
50
    project = Project.find_by(name: 'Community')
51 52 53
    page.should have_field('project_clone', with: project.http_url_to_repo)
  end

54
  step 'I should see an ssh link to the repository' do
skv committed
55
    project = Project.find_by(name: 'Community')
56 57
    page.should have_field('project_clone', with: project.url_to_repo)
  end
58 59 60 61

  step 'I visit "Community" issues page' do
    create(:issue,
       title: "Bug",
62
       project: public_project
63 64 65
      )
    create(:issue,
       title: "New feature",
66
       project: public_project
67
      )
68
    visit project_issues_path(public_project)
69 70 71 72 73
  end


  step 'I should see list of issues for "Community" project' do
    page.should have_content "Bug"
74
    page.should have_content public_project.name
75 76
    page.should have_content "New feature"
  end
77 78 79 80

  step 'I visit "Internal" issues page' do
    create(:issue,
       title: "Internal Bug",
81
       project: internal_project
82 83 84
      )
    create(:issue,
       title: "New internal feature",
85
       project: internal_project
86
      )
87
    visit project_issues_path(internal_project)
88 89 90 91 92
  end


  step 'I should see list of issues for "Internal" project' do
    page.should have_content "Internal Bug"
93
    page.should have_content internal_project.name
94 95
    page.should have_content "New internal feature"
  end
96 97

  step 'I visit "Community" merge requests page' do
98 99 100 101
    visit project_merge_requests_path(public_project)
  end

  step 'project "Community" has "Bug fix" open merge request' do
102
    create(:merge_request,
103 104 105
      title: "Bug fix for public project",
      source_project: public_project,
      target_project: public_project,
106 107 108 109
    )
  end

  step 'I should see list of merge requests for "Community" project' do
110 111
    page.should have_content public_project.name
    page.should have_content public_merge_request.source_project.name
112 113 114
  end

  step 'I visit "Internal" merge requests page' do
115 116 117 118
    visit project_merge_requests_path(internal_project)
  end

  step 'project "Internal" has "Feature implemented" open merge request' do
119
    create(:merge_request,
120 121 122
      title: "Feature implemented",
      source_project: internal_project,
      target_project: internal_project
123 124 125 126
    )
  end

  step 'I should see list of merge requests for "Internal" project' do
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
    page.should have_content internal_project.name
    page.should have_content internal_merge_request.source_project.name
  end

  def internal_project
    @internal_project ||= Project.find_by!(name: 'Internal')
  end

  def public_project
    @public_project ||= Project.find_by!(name: 'Community')
  end


  def internal_merge_request
    @internal_merge_request ||= MergeRequest.find_by!(title: 'Feature implemented')
  end
143

144 145
  def public_merge_request
    @public_merge_request ||= MergeRequest.find_by!(title: 'Bug fix for public project')
146
  end
147 148
end