Skip to content

Commit

Permalink
Preventing some duplication in MR feature tests by adding a different…
Browse files Browse the repository at this point in the history
… comment.
  • Loading branch information
maxlazio committed Oct 6, 2014
1 parent 270efdf commit 9535ce2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
6 changes: 2 additions & 4 deletions features/project/merge_requests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,14 @@ Feature: Project Merge Requests
And I switch to the diff tab
And I leave a comment like "Line is wrong" on line 39 of the second file
And I click link "Hide inline discussion" of the second file
Then I should not see a comment like "Line is wrong" in the second file
Then I should not see a comment like "Line is wrong here" in the second file

@javascript
Scenario: I show comments on a merge request diff with comments in a single file
Given project "Shop" have "Bug NS-05" open merge request with diffs inside
And I visit merge request page "Bug NS-05"
And I switch to the diff tab
And I leave a comment like "Line is wrong" on line 39 of the second file
And I click link "Hide inline discussion" of the second file
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

@javascript
Expand All @@ -125,7 +123,7 @@ Feature: Project Merge Requests
And I leave a comment like "Line is correct" on line 12 of the first file
And I leave a comment like "Line is wrong" on line 39 of the second file
And I click link "Hide inline discussion" of the second file
Then I should not see a comment like "Line is wrong" in the second file
Then I should not see a comment like "Line is wrong here" in the second file
And I should still see a comment like "Line is correct" in the first file

@javascript
Expand Down
18 changes: 13 additions & 5 deletions features/steps/project/merge_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,18 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
end

step 'I should not see a comment like "Line is wrong here" in the second file' do
within '.files [id^=diff]:nth-child(2)' do
page.should_not have_visible_content "Line is wrong here"
end
end

step 'I should see a comment like "Line is wrong here" in the second file' do
within '.files [id^=diff]:nth-child(2) .note-text' do
page.should have_visible_content "Line is wrong here"
end
end

step 'I leave a comment like "Line is correct" on line 12 of the first file' do
init_diff_note_first_file

Expand All @@ -228,13 +240,9 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
init_diff_note_second_file

within(".js-discussion-note-form") do
fill_in "note_note", with: "Line is wrong"
fill_in "note_note", with: "Line is wrong on here"
click_button "Add Comment"
end

within ".files [id^=diff]:nth-child(2) .note-text" do
page.should have_content "Line is wrong"
end
end

step 'I should still see a comment like "Line is correct" in the first file' do
Expand Down

0 comments on commit 9535ce2

Please sign in to comment.