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.
This commit is contained in:
parent
0d2c68d546
commit
2669fdbe74
1 changed files with 14 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue