BigW Consortium Gitlab

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

7
  step 'I should see project "Empty Public Project"' do
8
    expect(page).to have_content "Empty Public Project"
9 10
  end

11
  step 'I should see public project details' do
12 13
    expect(page).to have_content '32 branches'
    expect(page).to have_content '16 tags'
14 15 16
  end

  step 'I should see project readme' do
17
    expect(page).to have_content 'README.md'
18 19
  end

20
  step 'I should see empty public project details' do
Phil Hughes committed
21
    expect(page).not_to have_content 'Git global setup'
22 23
  end

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

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

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

44
  step 'I should see project "Internal" home page' do
45
    page.within '.navbar-gitlab .title' do
46
      expect(page).to have_content 'Internal'
47
    end
48
  end
49

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

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

  step 'I visit "Community" issues page' do
    create(:issue,
       title: "Bug",
63
       project: public_project
64
          )
65 66
    create(:issue,
       title: "New feature",
67
       project: public_project
68
          )
Vinnie Okada committed
69
    visit namespace_project_issues_path(public_project.namespace, public_project)
70 71 72
  end

  step 'I should see list of issues for "Community" project' do
73 74 75
    expect(page).to have_content "Bug"
    expect(page).to have_content public_project.name
    expect(page).to have_content "New feature"
76
  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
          )
Vinnie Okada committed
87
    visit namespace_project_issues_path(internal_project.namespace, internal_project)
88 89 90
  end

  step 'I should see list of issues for "Internal" project' do
91 92 93
    expect(page).to have_content "Internal Bug"
    expect(page).to have_content internal_project.name
    expect(page).to have_content "New internal feature"
94
  end
95 96

  step 'I visit "Community" merge requests page' do
Vinnie Okada committed
97
    visit namespace_project_merge_requests_path(public_project.namespace, public_project)
98 99 100
  end

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

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

  step 'I visit "Internal" merge requests page' do
Vinnie Okada committed
114
    visit namespace_project_merge_requests_path(internal_project.namespace, internal_project)
115 116 117
  end

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

  step 'I should see list of merge requests for "Internal" project' do
126 127
    expect(page).to have_content internal_project.name
    expect(page).to have_content internal_merge_request.source_project.name
128 129 130 131 132 133 134 135 136 137 138 139 140
  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
141

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