summaryrefslogtreecommitdiff
path: root/features/steps/project/labels.rb
blob: 3d9aa29299c6cbd3252f3dae56d0b8cc247aa3c7 (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
class ProjectLabels < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedProject
  include SharedPaths

  step 'I should see label "bug"' do
    within ".manage-labels-list" do
      page.should have_content "bug"
    end
  end

  step 'I should see label "feature"' do
    within ".manage-labels-list" do
      page.should have_content "feature"
    end
  end

  step 'I visit \'bug\' label edit page' do
    visit edit_project_label_path(project, bug_label)
  end

  step 'I remove label \'bug\'' do
    within "#label_#{bug_label.id}" do
      click_link 'Remove'
    end
  end

  step 'I submit new label \'support\'' do
    fill_in 'Title', with: 'support'
    fill_in 'Background Color', with: '#F95610'
    click_button 'Save'
  end

  step 'I should not see label \'bug\'' do
    within '.manage-labels-list' do
      page.should_not have_content 'bug'
    end
  end

  step 'I should see label \'support\'' do
    within '.manage-labels-list' do
      page.should have_content 'support'
    end
  end

  step 'I change label \'bug\' to \'fix\'' do
    fill_in 'Title', with: 'fix'
    fill_in 'Background Color', with: '#F15610'
    click_button 'Save'
  end

  step 'I should see label \'fix\'' do
    within '.manage-labels-list' do
      page.should have_content 'fix'
    end
  end

  def bug_label
    project.labels.find_or_create_by(title: 'bug')
  end
end