diff options
author | Phil Hughes <me@iamphill.com> | 2016-08-30 13:21:29 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-08-30 13:21:29 +0300 |
commit | 7418873b41acb142d33443fcbbe45e4ca6bdfd08 (patch) | |
tree | d6086ee6ea4131406a5686638ff69ca51b6956bf /spec/features/issues_spec.rb | |
parent | a6e312bf1dd01aa653761c5bf1e848df9707c0cb (diff) | |
parent | 2778dec131c2afac9fcdb2c42365b69099a5ae5b (diff) |
Merge branch 'master' into revert-c676283b
Diffstat (limited to 'spec/features/issues_spec.rb')
-rw-r--r-- | spec/features/issues_spec.rb | 77 |
1 files changed, 55 insertions, 22 deletions
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index d00cffa4e2b..36ef28ae992 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' describe 'Issues', feature: true do + include IssueHelpers include SortingHelper let(:project) { create(:project) } @@ -25,7 +26,7 @@ describe 'Issues', feature: true do find('.js-zen-enter').click end - it 'should open new issue popup' do + it 'opens new issue popup' do expect(page).to have_content("Issue ##{issue.iid}") end @@ -69,7 +70,7 @@ describe 'Issues', feature: true do visit new_namespace_project_issue_path(project.namespace, project) end - it 'should save with due date' do + it 'saves with due date' do date = Date.today.at_beginning_of_month fill_in 'issue_title', with: 'bug 345' @@ -97,7 +98,7 @@ describe 'Issues', feature: true do visit edit_namespace_project_issue_path(project.namespace, project, issue) end - it 'should save with due date' do + it 'saves with due date' do date = Date.today.at_beginning_of_month expect(find('#issuable-due-date').value).to eq date.to_s @@ -120,6 +121,17 @@ describe 'Issues', feature: true do expect(page).to have_content date.to_s(:medium) end end + + it 'warns about version conflict' do + issue.update(title: "New title") + + fill_in 'issue_title', with: 'bug 345' + fill_in 'issue_description', with: 'bug description' + + click_button 'Save changes' + + expect(page).to have_content 'Someone edited the issue the same time you did' + end end end @@ -153,7 +165,7 @@ describe 'Issues', feature: true do let(:issue) { @issue } - it 'should allow filtering by issues with no specified assignee' do + it 'allows filtering by issues with no specified assignee' do visit namespace_project_issues_path(project.namespace, project, assignee_id: IssuableFinder::NONE) expect(page).to have_content 'foobar' @@ -161,7 +173,7 @@ describe 'Issues', feature: true do expect(page).not_to have_content 'gitlab' end - it 'should allow filtering by a specified assignee' do + it 'allows filtering by a specified assignee' do visit namespace_project_issues_path(project.namespace, project, assignee_id: @user.id) expect(page).not_to have_content 'foobar' @@ -185,15 +197,15 @@ describe 'Issues', feature: true do it 'sorts by newest' do visit namespace_project_issues_path(project.namespace, project, sort: sort_value_recently_created) - expect(first_issue).to include('baz') - expect(last_issue).to include('foo') + expect(first_issue).to include('foo') + expect(last_issue).to include('baz') end it 'sorts by oldest' do visit namespace_project_issues_path(project.namespace, project, sort: sort_value_oldest_created) - expect(first_issue).to include('foo') - expect(last_issue).to include('baz') + expect(first_issue).to include('baz') + expect(last_issue).to include('foo') end it 'sorts by most recently updated' do @@ -349,8 +361,8 @@ describe 'Issues', feature: true do sort: sort_value_oldest_created, assignee_id: user2.id) - expect(first_issue).to include('foo') - expect(last_issue).to include('bar') + expect(first_issue).to include('bar') + expect(last_issue).to include('foo') expect(page).not_to have_content 'baz' end end @@ -512,7 +524,7 @@ describe 'Issues', feature: true do visit new_namespace_project_issue_path(project.namespace, project) end - it 'should upload file when dragging into textarea' do + it 'uploads file when dragging into textarea' do drop_in_dropzone test_image_file # Wait for the file to upload @@ -523,6 +535,35 @@ describe 'Issues', feature: true do end end + xdescribe 'new issue by email' do + shared_examples 'show the email in the modal' do + before do + stub_incoming_email_setting(enabled: true, address: "p+%{key}@gl.ab") + + visit namespace_project_issues_path(project.namespace, project) + click_button('Email a new issue') + end + + it 'click the button to show modal for the new email' do + page.within '#issue-email-modal' do + email = project.new_issue_address(@user) + + expect(page).to have_selector("input[value='#{email}']") + end + end + end + + context 'with existing issues' do + let!(:issue) { create(:issue, project: project, author: @user) } + + it_behaves_like 'show the email in the modal' + end + + context 'without existing issues' do + it_behaves_like 'show the email in the modal' + end + end + describe 'due date' do context 'update due on issue#show', js: true do let(:issue) { create(:issue, project: project, author: @user, assignee: @user) } @@ -531,7 +572,7 @@ describe 'Issues', feature: true do visit namespace_project_issue_path(project.namespace, project, issue) end - it 'should add due date to issue' do + it 'adds due date to issue' do page.within '.due_date' do click_link 'Edit' @@ -543,7 +584,7 @@ describe 'Issues', feature: true do end end - it 'should remove due date from issue' do + it 'removes due date from issue' do page.within '.due_date' do click_link 'Edit' @@ -560,14 +601,6 @@ describe 'Issues', feature: true do end end - def first_issue - page.all('ul.issues-list > li').first.text - end - - def last_issue - page.all('ul.issues-list > li').last.text - end - def drop_in_dropzone(file_path) # Generate a fake input selector page.execute_script <<-JS |