BigW Consortium Gitlab

milestones.rb 2.12 KB
Newer Older
1
class Spinach::Features::ProjectIssuesMilestones < Spinach::FeatureSteps
Nihad Abbasov committed
2 3 4
  include SharedAuthentication
  include SharedProject
  include SharedPaths
5
  include SharedMarkdown
Nihad Abbasov committed
6

7
  step 'I should see milestone "v2.2"' do
skv committed
8
    milestone = @project.milestones.find_by(title: "v2.2")
9 10 11
    expect(page).to have_content(milestone.title[0..10])
    expect(page).to have_content(milestone.expires_at)
    expect(page).to have_content("Issues")
12 13
  end

14
  step 'I click link "v2.2"' do
15 16 17
    click_link "v2.2"
  end

18
  step 'I click link "New Milestone"' do
19 20 21
    click_link "New Milestone"
  end

22
  step 'I submit new milestone "v2.3"' do
23
    fill_in "milestone_title", with: "v2.3"
24 25 26
    click_button "Create milestone"
  end

27
  step 'I should see milestone "v2.3"' do
skv committed
28
    milestone = @project.milestones.find_by(title: "v2.3")
29 30 31
    expect(page).to have_content(milestone.title[0..10])
    expect(page).to have_content(milestone.expires_at)
    expect(page).to have_content("Issues")
32 33
  end

34
  step 'project "Shop" has milestone "v2.2"' do
skv committed
35
    project = Project.find_by(name: "Shop")
36 37 38 39 40
    milestone = create(:milestone,
                       title: "v2.2",
                       project: project,
                       description: "# Description header"
                      )
41
    3.times { create(:issue, project: project, milestone: milestone) }
42
  end
43

44
  step 'the milestone has open and closed issues' do
skv committed
45 46
    project = Project.find_by(name: "Shop")
    milestone = project.milestones.find_by(title: 'v2.2')
47 48 49 50 51

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

52 53 54 55 56
  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

57 58 59 60
  When 'I click link "All Issues"' do
    click_link 'All Issues'
  end

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

65
  step 'I click link to remove milestone' do
66
    click_link 'Delete'
67 68 69 70 71
  end

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