diff options
author | Toon Claes <toon@gitlab.com> | 2017-01-25 13:07:02 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-01-25 13:07:02 +0300 |
commit | 2669fdbe74a50f80d86119469deb1f48575816f5 (patch) | |
tree | 4e4a1a6353a6cc9dd106dfb2e1cbed436bce9fe4 /spec/features/projects/merge_request_button_spec.rb | |
parent | 0d2c68d546cb58760a9d30a41b1454b02c462ad8 (diff) |
Ensure the correct Merge Request button is found
The project was not public and this caused a 404. So the tests were
giving deceiving results.
By searching for the Merge Request button in `#content-body` this
is overcome, and also other Merge Request buttons (e.g. in the
sidebar) are ignored.
Diffstat (limited to 'spec/features/projects/merge_request_button_spec.rb')
-rw-r--r-- | spec/features/projects/merge_request_button_spec.rb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/spec/features/projects/merge_request_button_spec.rb b/spec/features/projects/merge_request_button_spec.rb index 177038f9a4c..e3c6347e81f 100644 --- a/spec/features/projects/merge_request_button_spec.rb +++ b/spec/features/projects/merge_request_button_spec.rb @@ -3,14 +3,16 @@ require 'spec_helper' feature 'Merge Request button', feature: true do shared_examples 'Merge Request button only shown when allowed' do let(:user) { create(:user) } - let(:project) { create(:project) } - let(:forked_project) { create(:project, forked_from_project: project) } + let(:project) { create(:project, :public) } + let(:forked_project) { create(:project, :public, forked_from_project: project) } context 'not logged in' do it 'does not show Create Merge Request button' do visit url - expect(page).not_to have_link(label) + within("#content-body") do + expect(page).not_to have_link(label) + end end end @@ -28,7 +30,9 @@ feature 'Merge Request button', feature: true do visit url - expect(page).to have_link(label, href: href) + within("#content-body") do + expect(page).to have_link(label, href: href) + end end end @@ -40,7 +44,9 @@ feature 'Merge Request button', feature: true do it 'does not show Create Merge Request button' do visit url - expect(page).not_to have_link(label) + within("#content-body") do + expect(page).not_to have_link(label) + end end context 'on own fork of project' do @@ -54,7 +60,9 @@ feature 'Merge Request button', feature: true do visit fork_url - expect(page).to have_link(label, href: href) + within("#content-body") do + expect(page).to have_link(label, href: href) + end end end end |