summaryrefslogtreecommitdiff
path: root/features/steps/project/commits/tags.rb
blob: 912ba580efd7a334d314f3b490d2d0b1a76ad419 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedProject
  include SharedPaths

  step 'I should see "Shop" all tags list' do
    expect(page).to have_content "Tags"
    expect(page).to have_content "v1.0.0"
  end

  step 'I click new tag link' do
    click_link 'New tag'
  end

  step 'I submit new tag form' do
    fill_in 'tag_name', with: 'v7.0'
    fill_in 'ref', with: 'master'
    click_button 'Create tag'
  end

  step 'I submit new tag form with release notes' do
    fill_in 'tag_name', with: 'v7.0'
    fill_in 'ref', with: 'master'
    fill_in 'release_description', with: 'Awesome release notes'
    click_button 'Create tag'
  end

  step 'I fill release notes and submit form' do
    fill_in 'release_description', with: 'Awesome release notes'
    click_button 'Save changes'
  end

  step 'I submit new tag form with invalid name' do
    fill_in 'tag_name', with: 'v 1.0'
    fill_in 'ref', with: 'master'
    click_button 'Create tag'
  end

  step 'I submit new tag form with invalid reference' do
    fill_in 'tag_name', with: 'foo'
    fill_in 'ref', with: 'foo'
    click_button 'Create tag'
  end

  step 'I submit new tag form with tag that already exists' do
    fill_in 'tag_name', with: 'v1.0.0'
    fill_in 'ref', with: 'master'
    click_button 'Create tag'
  end

  step 'I should see new tag created' do
    expect(page).to have_content 'v7.0'
  end

  step 'I should see new an error that tag is invalid' do
    expect(page).to have_content 'Tag name invalid'
  end

  step 'I should see new an error that tag ref is invalid' do
    expect(page).to have_content 'Target foo is invalid'
  end

  step 'I should see new an error that tag already exists' do
    expect(page).to have_content 'Tag v1.0.0 already exists'
  end

  step "I visit tag 'v1.1.0' page" do
    click_link 'v1.1.0'
  end

  step "I delete tag 'v1.1.0'" do
    page.within('.content') do
      first('.btn-remove').click
    end
  end

  step "I should not see tag 'v1.1.0'" do
    page.within '.tags' do
      expect(page).not_to have_link 'v1.1.0'
    end
  end

  step 'I click edit tag link' do
    click_link 'Edit release notes'
  end

  step 'I should see tag release notes' do
    expect(page).to have_content 'Awesome release notes'
  end
end