Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCiro Santillli <ciro.santilli@gmail.com>2014-02-23 13:04:56 +0400
committerCiro Santillli <ciro.santilli@gmail.com>2014-02-23 13:34:39 +0400
commit170340e6b15f91e79cf683c892ec887c3115b317 (patch)
tree19cf1f82b08201295b3e66170a967e813c522189 /features/steps/project/merge_requests.rb
parente868de687da060a109bd67fd492ed110eb134d47 (diff)
Remove dir prefix and suffix from tests inside dir.
Diffstat (limited to 'features/steps/project/merge_requests.rb')
-rw-r--r--features/steps/project/merge_requests.rb195
1 files changed, 195 insertions, 0 deletions
diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb
new file mode 100644
index 00000000000..adf9e77e136
--- /dev/null
+++ b/features/steps/project/merge_requests.rb
@@ -0,0 +1,195 @@
+class ProjectMergeRequests < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedProject
+ include SharedNote
+ include SharedPaths
+ include SharedMarkdown
+
+ step 'I click link "New Merge Request"' do
+ click_link "New Merge Request"
+ end
+
+ step 'I click link "Bug NS-04"' do
+ click_link "Bug NS-04"
+ end
+
+ step 'I click link "All"' do
+ click_link "All"
+ end
+
+ step 'I click link "Closed"' do
+ click_link "Closed"
+ end
+
+ step 'I should see merge request "Wiki Feature"' do
+ within '.merge-request' do
+ page.should have_content "Wiki Feature"
+ end
+ end
+
+ step 'I should see closed merge request "Bug NS-04"' do
+ merge_request = MergeRequest.find_by!(title: "Bug NS-04")
+ merge_request.closed?.should be_true
+ page.should have_content "Closed by"
+ end
+
+ step 'I should see merge request "Bug NS-04"' do
+ page.should have_content "Bug NS-04"
+ end
+
+ step 'I should see "Bug NS-04" in merge requests' do
+ page.should have_content "Bug NS-04"
+ end
+
+ step 'I should see "Feature NS-03" in merge requests' do
+ page.should have_content "Feature NS-03"
+ end
+
+ step 'I should not see "Feature NS-03" in merge requests' do
+ page.should_not have_content "Feature NS-03"
+ end
+
+
+ step 'I should not see "Bug NS-04" in merge requests' do
+ page.should_not have_content "Bug NS-04"
+ end
+
+ step 'I click link "Close"' do
+ within '.page-title' do
+ click_link "Close"
+ end
+ end
+
+ step 'I submit new merge request "Wiki Feature"' do
+ fill_in "merge_request_title", with: "Wiki Feature"
+ select "master", from: "merge_request_source_branch"
+ select "notes_refactoring", from: "merge_request_target_branch"
+ click_button "Submit merge request"
+ end
+
+ step 'project "Shop" have "Bug NS-04" open merge request' do
+ create(:merge_request,
+ title: "Bug NS-04",
+ source_project: project,
+ target_project: project,
+ source_branch: 'stable',
+ target_branch: 'master',
+ author: project.users.first,
+ description: "# Description header"
+ )
+ end
+
+ step 'project "Shop" have "Bug NS-05" open merge request with diffs inside' do
+ create(:merge_request_with_diffs,
+ title: "Bug NS-05",
+ source_project: project,
+ target_project: project,
+ author: project.users.first)
+ end
+
+ step 'project "Shop" have "Feature NS-03" closed merge request' do
+ create(:closed_merge_request,
+ title: "Feature NS-03",
+ source_project: project,
+ target_project: project,
+ author: project.users.first)
+ end
+
+ step 'I switch to the diff tab' do
+ visit diffs_project_merge_request_path(project, merge_request)
+ end
+
+ step 'I switch to the merge request\'s comments tab' do
+ visit project_merge_request_path(project, merge_request)
+ end
+
+ step 'I click on the first commit in the merge request' do
+ within '.first-commits' do
+ click_link merge_request.commits.first.short_id(8)
+ end
+ end
+
+ step 'I leave a comment on the diff page' do
+ init_diff_note
+ leave_comment "One comment to rule them all"
+ end
+
+ step 'I leave a comment on the diff page in commit' do
+ find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click
+ leave_comment "One comment to rule them all"
+ end
+
+ step 'I leave a comment like "Line is wrong" on line 185 of the first file' do
+ init_diff_note
+ leave_comment "Line is wrong"
+ end
+
+ step 'I leave a comment like "Line is wrong" on line 185 of the first file in commit' do
+ find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185"]').click
+ leave_comment "Line is wrong"
+ end
+
+ step 'I should see a discussion has started on line 185' do
+ page.should have_content "#{current_user.name} started a discussion on this merge request diff"
+ page.should have_content "app/assets/stylesheets/tree.scss:L185"
+ page.should have_content "Line is wrong"
+ end
+
+ step 'I should see a discussion has started on commit b1e6a9dbf1:L185' do
+ page.should have_content "#{current_user.name} started a discussion on commit"
+ page.should have_content "app/assets/stylesheets/tree.scss:L185"
+ page.should have_content "Line is wrong"
+ end
+
+ step 'I should see a discussion has started on commit b1e6a9dbf1' do
+ page.should have_content "#{current_user.name} started a discussion on commit"
+ page.should have_content "One comment to rule them all"
+ page.should have_content "app/assets/stylesheets/tree.scss:L185"
+ end
+
+ step 'merge request is mergeable' do
+ page.should have_content 'You can accept this request automatically'
+ end
+
+ step 'I modify merge commit message' do
+ find('.modify-merge-commit-link').click
+ fill_in 'merge_commit_message', with: "wow such merge"
+ end
+
+ step 'merge request "Bug NS-05" is mergeable' do
+ merge_request.mark_as_mergeable
+ end
+
+ step 'I accept this merge request' do
+ click_button "Accept Merge Request"
+ end
+
+ step 'I should see merged request' do
+ within '.issue-box' do
+ page.should have_content "Merged"
+ end
+ end
+
+ def project
+ @project ||= Project.find_by!(name: "Shop")
+ end
+
+ def merge_request
+ @merge_request ||= MergeRequest.find_by!(title: "Bug NS-05")
+ end
+
+ def init_diff_note
+ find('a[data-line-code="4735dfc552ad7bf15ca468adc3cad9d05b624490_172_185"]').click
+ end
+
+ def leave_comment(message)
+ within(".js-discussion-note-form") do
+ fill_in "note_note", with: message
+ click_button "Add Comment"
+ end
+
+ within ".note-text" do
+ page.should have_content message
+ end
+ end
+end