summaryrefslogtreecommitdiff
path: root/features/steps/project/issues/milestones.rb
blob: e2eda511497f4d6e4bb7974e41f94b8046d04768 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedProject
  include SharedPaths
  include SharedMarkdown

  step 'I should see milestone "v2.2"' do
    milestone = @project.milestones.find_by(title: "v2.2")
    expect(page).to have_content(milestone.title[0..10])
    expect(page).to have_content(milestone.expires_at)
    expect(page).to have_content("Issues")
  end

  step 'I click link "v2.2"' do
    click_link "v2.2"
  end

  step 'I click link "New Milestone"' do
    click_link "New Milestone"
  end

  step 'I submit new milestone "v2.3"' do
    fill_in "milestone_title", with: "v2.3"
    click_button "Create milestone"
  end

  step 'I should see milestone "v2.3"' do
    milestone = @project.milestones.find_by(title: "v2.3")
    expect(page).to have_content(milestone.title[0..10])
    expect(page).to have_content(milestone.expires_at)
    expect(page).to have_content("Issues")
  end

  step 'project "Shop" has milestone "v2.2"' do
    project = Project.find_by(name: "Shop")
    milestone = create(:milestone,
                       title: "v2.2",
                       project: project,
                       description: "# Description header"
                      )
    3.times { create(:issue, project: project, milestone: milestone) }
  end

  step 'the milestone has open and closed issues' do
    project = Project.find_by(name: "Shop")
    milestone = project.milestones.find_by(title: 'v2.2')

    # 3 Open issues created above; create one closed issue
    create(:closed_issue, project: project, milestone: milestone)
  end

  step 'I should see deleted milestone activity' do
    expect(page).to have_content('opened milestone in')
    expect(page).to have_content('destroyed milestone in')
  end

  When 'I click link "All Issues"' do
    click_link 'All Issues'
  end

  step 'I should see 3 issues' do
    expect(page).to have_selector('#tab-issues li.issue-row', count: 4)
  end

  step 'I click link to remove milestone' do
    click_link 'Delete'
  end

  step 'I should see no milestones' do
    expect(page).to have_content('No milestones to show')
  end
end