diff options
| author | John Jarvis <jarv@gitlab.com> | 2019-04-02 10:12:32 +0200 |
|---|---|---|
| committer | John Jarvis <jarv@gitlab.com> | 2019-04-02 10:12:32 +0200 |
| commit | 69b65a6b745e74bba290787420a0017395fd7c25 (patch) | |
| tree | c328963cbe5b340c58c88230d21f338c77462ebd /spec/features/issues | |
| parent | 1b6fe3ae226e4c6f481c90c886e242fcd96ab11b (diff) | |
| parent | 3e81a5baf25d6ecd9ad807a2b8f4238dcc598d5e (diff) | |
| download | gitlab-ce-69b65a6b745e74bba290787420a0017395fd7c25.tar.gz | |
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq into jarv/dev-to-gitlab-2019-04-02jarv/dev-to-gitlab-2019-04-02
Diffstat (limited to 'spec/features/issues')
| -rw-r--r-- | spec/features/issues/user_creates_branch_and_merge_request_spec.rb | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/spec/features/issues/user_creates_branch_and_merge_request_spec.rb b/spec/features/issues/user_creates_branch_and_merge_request_spec.rb index 693ad89069c..0a006011c89 100644 --- a/spec/features/issues/user_creates_branch_and_merge_request_spec.rb +++ b/spec/features/issues/user_creates_branch_and_merge_request_spec.rb @@ -1,6 +1,7 @@ require 'rails_helper' describe 'User creates branch and merge request on issue page', :js do + let(:membership_level) { :developer } let(:user) { create(:user) } let!(:project) { create(:project, :repository) } let(:issue) { create(:issue, project: project, title: 'Cherry-Coloured Funk') } @@ -17,7 +18,7 @@ describe 'User creates branch and merge request on issue page', :js do context 'when signed in' do before do - project.add_developer(user) + project.add_user(user, membership_level) sign_in(user) end @@ -167,6 +168,39 @@ describe 'User creates branch and merge request on issue page', :js do expect(page).not_to have_css('.create-mr-dropdown-wrap') end end + + context 'when related branch exists' do + let!(:project) { create(:project, :repository, :private) } + let(:branch_name) { "#{issue.iid}-foo" } + + before do + project.repository.create_branch(branch_name, 'master') + + visit project_issue_path(project, issue) + end + + context 'when user is developer' do + it 'shows related branches' do + expect(page).to have_css('#related-branches') + + wait_for_requests + + expect(page).to have_content(branch_name) + end + end + + context 'when user is guest' do + let(:membership_level) { :guest } + + it 'does not show related branches' do + expect(page).not_to have_css('#related-branches') + + wait_for_requests + + expect(page).not_to have_content(branch_name) + end + end + end end private |
