Correct usage of the have_link matcher

The second option to this matcher should be an options hash; anything
else is just ignored, which can lead to false positives in tests.

We see one such false positive in the "Learn more" link test in
`spec/features/projects/blobs/blob_show_spec.rb`.
This commit is contained in:
Robert Speicher 2018-09-14 15:36:40 -05:00
parent 165e9a99c0
commit 14a27a4f40
No known key found for this signature in database
GPG key ID: 1D812769A7706642
2 changed files with 5 additions and 5 deletions

View file

@ -533,7 +533,7 @@ describe 'File blob', :js do
expect(page).to have_content('This project is licensed under the MIT License.')
# shows a learn more link
expect(page).to have_link('Learn more', 'http://choosealicense.com/licenses/mit/')
expect(page).to have_link('Learn more', href: 'http://choosealicense.com/licenses/mit/')
end
end
end
@ -566,10 +566,10 @@ describe 'File blob', :js do
expect(page).to have_content('This project manages its dependencies using RubyGems and defines a gem named activerecord.')
# shows a link to the gem
expect(page).to have_link('activerecord', 'https://rubygems.org/gems/activerecord')
expect(page).to have_link('activerecord', href: 'https://rubygems.org/gems/activerecord')
# shows a learn more link
expect(page).to have_link('Learn more', 'http://choosealicense.com/licenses/mit/')
expect(page).to have_link('Learn more', href: 'https://rubygems.org/')
end
end
end

View file

@ -21,7 +21,7 @@ describe 'help/index' do
render
expect(rendered).to match '8.0.2'
expect(rendered).to have_link('abcdefg', 'https://gitlab.com/gitlab-org/gitlab-ce/commits/abcdefg')
expect(rendered).to have_link('abcdefg', href: 'https://gitlab.com/gitlab-org/gitlab-ce/commits/abcdefg')
end
end
@ -29,7 +29,7 @@ describe 'help/index' do
it 'is visible to guests' do
render
expect(rendered).to have_link(nil, help_instance_configuration_url)
expect(rendered).to have_link(nil, href: help_instance_configuration_url)
end
end