Commit 6f15356a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add tests to release notes feature

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent cb8b9c3f
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
.gray-content-block .gray-content-block
.pull-right .pull-right
= link_to edit_namespace_project_tag_release_path(@project.namespace, @project, @tag.name), class: 'btn-grouped btn' do = link_to edit_namespace_project_tag_release_path(@project.namespace, @project, @tag.name), class: 'btn-grouped btn', title: 'Edit release notes' do
= icon("pencil") = icon("pencil")
= link_to namespace_project_tree_path(@project.namespace, @project, @tag.name), class: 'btn btn-grouped' do = link_to namespace_project_tree_path(@project.namespace, @project, @tag.name), class: 'btn btn-grouped', title: 'Browse source code' do
= icon('files-o') = icon('files-o')
= link_to namespace_project_commits_path(@project.namespace, @project, @tag.name), class: 'btn btn-grouped' do = link_to namespace_project_commits_path(@project.namespace, @project, @tag.name), class: 'btn btn-grouped', title: 'Browse commits' do
= icon('history') = icon('history')
- if can? current_user, :download_code, @project - if can? current_user, :download_code, @project
= render 'projects/tags/download', ref: @tag.name, project: @project = render 'projects/tags/download', ref: @tag.name, project: @project
......
...@@ -12,6 +12,12 @@ Feature: Project Commits Tags ...@@ -12,6 +12,12 @@ Feature: Project Commits Tags
And I submit new tag form And I submit new tag form
Then I should see new tag created Then I should see new tag created
Scenario: I create a tag with release notes
Given I click new tag link
And I submit new tag form with release notes
Then I should see new tag created
And I should see tag release notes
Scenario: I create a tag with invalid name Scenario: I create a tag with invalid name
And I click new tag link And I click new tag link
And I submit new tag form with invalid name And I submit new tag form with invalid name
...@@ -31,3 +37,9 @@ Feature: Project Commits Tags ...@@ -31,3 +37,9 @@ Feature: Project Commits Tags
Given I visit tag 'v1.1.0' page Given I visit tag 'v1.1.0' page
Given I delete tag 'v1.1.0' Given I delete tag 'v1.1.0'
Then I should not see tag 'v1.1.0' Then I should not see tag 'v1.1.0'
Scenario: I add release notes to the tag
Given I visit tag 'v1.1.0' page
When I click edit tag link
And I fill release notes and submit form
Then I should see tag release notes
...@@ -18,6 +18,18 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps ...@@ -18,6 +18,18 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps
click_button 'Create tag' click_button 'Create tag'
end 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 step 'I submit new tag form with invalid name' do
fill_in 'tag_name', with: 'v 1.0' fill_in 'tag_name', with: 'v 1.0'
fill_in 'ref', with: 'master' fill_in 'ref', with: 'master'
...@@ -67,4 +79,12 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps ...@@ -67,4 +79,12 @@ class Spinach::Features::ProjectCommitsTags < Spinach::FeatureSteps
expect(page).not_to have_link 'v1.1.0' expect(page).not_to have_link 'v1.1.0'
end end
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 end
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
FactoryGirl.define do FactoryGirl.define do
factory :release do factory :release do
tag "MyString" tag "v1.1.0"
description "MyText" description "Awesome release"
project_id 1 project
end end
end end
require 'rails_helper' require 'rails_helper'
RSpec.describe Release, type: :model do RSpec.describe Release, type: :model do
pending "add some examples to (or delete) #{__FILE__}" let(:release) { create(:release) }
it { expect(release).to be_valid }
describe 'associations' do
it { is_expected.to belong_to(:project) }
end
describe 'validation' do
it { is_expected.to validate_presence_of(:project) }
it { is_expected.to validate_presence_of(:description) }
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment