dashboard_issues.rb 1.6 KB
Newer Older
1
class DashboardIssues < Spinach::FeatureSteps
N
Nihad Abbasov 已提交
2 3 4
  include SharedAuthentication
  include SharedPaths

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
  step 'I should see issues assigned to me' do
    should_see(assigned_issue)
    should_not_see(authored_issue)
    should_not_see(other_issue)
  end

  step 'I should see issues authored by me' do
    should_see(authored_issue)
    should_not_see(assigned_issue)
    should_not_see(other_issue)
  end

  step 'I should see all issues' do
    should_see(authored_issue)
    should_see(assigned_issue)
    should_see(other_issue)
  end

  step 'I have authored issues' do
    authored_issue
  end

  step 'I have assigned issues' do
    assigned_issue
  end

  step 'I have other issues' do
    other_issue
  end

  step 'I click "Authored by me" link' do
    within ".scope-filter" do
37
      click_link 'Created by me'
38 39 40
    end
  end

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
  step 'I click "All" link' do
    within ".scope-filter" do
      click_link 'All'
    end
  end

  def should_see(issue)
    page.should have_content(issue.title[0..10])
  end

  def should_not_see(issue)
    page.should_not have_content(issue.title[0..10])
  end

  def assigned_issue
    @assigned_issue ||= create :issue, assignee: current_user, project: project
  end

  def authored_issue
    @authored_issue ||= create :issue, author: current_user, project: project
  end

  def other_issue
    @other_issue ||= create :issue, project: project
  end
66

67 68 69 70 71 72
  def project
    @project ||= begin
                   project =create :project_with_code
                   project.team << [current_user, :master]
                   project
                 end
73 74
  end
end