From 9ff69c4c4b013c2cb0217cfcdfdb925e1f2bb2b1 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 8 May 2014 14:44:05 +0200 Subject: [PATCH] Add tests for template mr description. --- features/project/merge_requests.feature | 4 ++++ features/project/project.feature | 7 +++++++ features/steps/project/merge_requests.rb | 4 ++++ features/steps/project/project.rb | 10 ++++++++++ features/steps/shared/project.rb | 2 +- 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature index 6a2ba7e3b2..8a0f14751e 100644 --- a/features/project/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -139,3 +139,7 @@ Feature: Project Merge Requests And I click link "Show inline discussion" of the second file Then I should see a comment like "Line is wrong" in the second file And I should still see a comment like "Line is correct" in the first file + + Scenario: I submit new unassigned merge request with template description + Given I click link "New Merge Request" + Then I should see description field pre-filled diff --git a/features/project/project.feature b/features/project/project.feature index d8bb1d55e2..a3ba418ad4 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -24,3 +24,10 @@ Feature: Project Feature When I visit edit project "Shop" page And change project path settings Then I should see project with new path settings + + Scenario: I visit edit project and fill in merge request template + When I visit edit project "Shop" page + Then I should see project settings + And I fill in merge request template + And I save project + Then I should see project with merge request template saved diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index e0aec699a5..738f32a529 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -239,6 +239,10 @@ class ProjectMergeRequests < Spinach::FeatureSteps end end + step 'I should see description field pre-filled' do + find_field('merge_request_description').value.should == 'This merge request should contain the following.' + end + def project @project ||= Project.find_by!(name: "Shop") end diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index 92728d474b..f604990841 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -14,6 +14,8 @@ class ProjectFeature < Spinach::FeatureSteps step 'I should see project with new settings' do find_field('project_name').value.should == 'NewName' + find('#project_issues_enabled').should_not be_checked + find('#project_merge_requests_enabled').should be_checked end step 'change project path settings' do @@ -24,4 +26,12 @@ class ProjectFeature < Spinach::FeatureSteps step 'I should see project with new path settings' do project.path.should == "new-path" end + + step 'I fill in merge request template' do + fill_in 'project_merge_requests_template', with: "This merge request should contain the following." + end + + step 'I should see project with merge request template saved' do + find_field('project_merge_requests_template').value.should == 'This merge request should contain the following.' + end end diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index f8cb753b78..9a58b74706 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -10,7 +10,7 @@ module SharedProject # Create a specific project called "Shop" And 'I own project "Shop"' do @project = Project.find_by(name: "Shop") - @project ||= create(:project, name: "Shop", namespace: @user.namespace) + @project ||= create(:project, name: "Shop", namespace: @user.namespace, merge_requests_template: "This merge request should contain the following.") @project.team << [@user, :master] end