project_issues.rb 3.92 KB
Newer Older
1
class ProjectIssues < Spinach::FeatureSteps
Nihad Abbasov's avatar
Nihad Abbasov committed
2 3 4 5 6
  include SharedAuthentication
  include SharedProject
  include SharedNote
  include SharedPaths

7 8 9 10 11 12 13 14
  Given 'I should see "Release 0.4" in issues' do
    page.should have_content "Release 0.4"
  end

  And 'I should not see "Release 0.3" in issues' do
    page.should_not have_content "Release 0.3"
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
15 16 17 18
  And 'I should not see "Tweet feature" in issues' do
    page.should_not have_content "Tweet feature"
  end

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
  Given 'I click link "Closed"' do
    click_link "Closed"
  end

  Then 'I should see "Release 0.3" in issues' do
    page.should have_content "Release 0.3"
  end

  And 'I should not see "Release 0.4" in issues' do
    page.should_not have_content "Release 0.4"
  end

  Given 'I click link "All"' do
    click_link "All"
  end

  Given 'I click link "Release 0.4"' do
    click_link "Release 0.4"
  end

  Then 'I should see issue "Release 0.4"' do
    page.should have_content "Release 0.4"
  end

  Given 'I click link "New Issue"' do
    click_link "New Issue"
  end

  And 'I submit new issue "500 error on profile"' do
48
    fill_in "issue_title", with: "500 error on profile"
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
    click_button "Submit new issue"
  end

  Given 'I click link "500 error on profile"' do
    click_link "500 error on profile"
  end

  Then 'I should see issue "500 error on profile"' do
    issue = Issue.find_by_title("500 error on profile")
    page.should have_content issue.title
    page.should have_content issue.author_name
    page.should have_content issue.project.name
  end

  Given 'I fill in issue search with "Release"' do
    fill_in 'issue_search', with: "Release"
65
    sleep 0.05
66 67 68 69
  end

  Given 'I fill in issue search with "Bug"' do
    fill_in 'issue_search', with: "Bug"
70
    sleep 0.05
71 72 73 74
  end

  And 'I fill in issue search with "0.3"' do
    fill_in 'issue_search', with: "0.3"
75
    sleep 0.05
76 77 78 79 80 81 82 83 84 85 86 87
  end

  And 'I fill in issue search with "Something"' do
    fill_in 'issue_search', with: "Something"
  end

  And 'I fill in issue search with ""' do
    fill_in 'issue_search', with: ""
  end

  Given 'project "Shop" has milestone "v2.2"' do
    project = Project.find_by_name("Shop")
88
    milestone = create(:milestone, title: "v2.2", project: project)
89

90
    3.times { create(:issue, project: project, milestone: milestone) }
91 92 93 94
  end

  And 'project "Shop" has milestone "v3.0"' do
    project = Project.find_by_name("Shop")
95
    milestone = create(:milestone, title: "v3.0", project: project)
96

97
    3.times { create(:issue, project: project, milestone: milestone) }
98 99 100 101 102 103 104
  end

  When 'I select milestone "v3.0"' do
    select "v3.0", from: "milestone_id"
  end

  Then 'I should see selected milestone with title "v3.0"' do
105
    issues_milestone_selector = "#issue_milestone_id_chzn > a"
106 107 108 109 110 111 112 113 114 115
    page.find(issues_milestone_selector).should have_content("v3.0")
  end

  When 'I select first assignee from "Shop" project' do
    project = Project.find_by_name "Shop"
    first_assignee = project.users.first
    select first_assignee.name, from: "assignee_id"
  end

  Then 'I should see first assignee from "Shop" as selected assignee' do
116
    issues_assignee_selector = "#issue_assignee_id_chzn > a"
117 118 119 120 121 122 123
    project = Project.find_by_name "Shop"
    assignee_name = project.users.first.name
    page.find(issues_assignee_selector).should have_content(assignee_name)
  end

  And 'project "Shop" have "Release 0.4" open issue' do
    project = Project.find_by_name("Shop")
124
    create(:issue,
125 126 127
           title: "Release 0.4",
           project: project,
           author: project.users.first)
128 129
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
130 131 132 133 134 135 136 137
  And 'project "Shop" have "Tweet feature" open issue' do
    project = Project.find_by_name("Shop")
    create(:issue,
           title: "Tweet feature",
           project: project,
           author: project.users.first)
  end

138 139
  And 'project "Shop" have "Release 0.3" closed issue' do
    project = Project.find_by_name("Shop")
Andrew8xx8's avatar
Andrew8xx8 committed
140
    create(:closed_issue,
141 142 143
           title: "Release 0.3",
           project: project,
           author: project.users.first)
144 145
  end
end