Commit 10c44bc2 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'pl-enable-lint-void' into 'master'

Fix remaining Enable RuboCop Lint/Void offenses

See merge request gitlab-org/gitlab!23269
parents aa35d995 0bea40b0
...@@ -87,26 +87,22 @@ RSpec.describe "User browses files" do ...@@ -87,26 +87,22 @@ RSpec.describe "User browses files" do
end end
it "shows correct files and links" do it "shows correct files and links" do
# rubocop:disable Lint/Void
# Test the full URLs of links instead of relative paths by `have_link(text: "...", href: "...")`.
find("a", text: /^empty$/)["href"] == project_tree_url(project, "markdown")
find("a", text: /^#id$/)["href"] == project_tree_url(project, "markdown", anchor: "#id")
find("a", text: %r{^/#id$})["href"] == project_tree_url(project, "markdown", anchor: "#id")
find("a", text: /^README.md#id$/)["href"] == project_blob_url(project, "markdown/README.md", anchor: "#id")
find("a", text: %r{^d/README.md#id$})["href"] == project_blob_url(project, "d/markdown/README.md", anchor: "#id")
# rubocop:enable Lint/Void
expect(current_path).to eq(project_tree_path(project, "markdown")) expect(current_path).to eq(project_tree_path(project, "markdown"))
expect(page).to have_content("README.md") expect(page).to have_content("README.md")
.and have_content("CHANGELOG") .and have_content("CHANGELOG")
.and have_content("Welcome to GitLab GitLab is a free project and repository management application") .and have_content("Welcome to GitLab GitLab is a free project and repository management application")
.and have_link("GitLab API doc") .and have_link("GitLab API doc")
.and have_link("GitLab API website") .and have_link("GitLab API website")
.and have_link("Rake tasks") .and have_link("Rake tasks")
.and have_link("backup and restore procedure") .and have_link("backup and restore procedure")
.and have_link("GitLab API doc directory") .and have_link("GitLab API doc directory")
.and have_link("Maintenance") .and have_link("Maintenance")
.and have_header_with_correct_id_and_link(2, "Application details", "application-details") .and have_header_with_correct_id_and_link(2, "Application details", "application-details")
.and have_link("empty", href: "")
.and have_link("#id", href: "#id")
.and have_link("/#id", href: project_blob_path(project, "markdown/README.md", anchor: "id"))
.and have_link("README.md#id", href: project_blob_path(project, "markdown/README.md", anchor: "id"))
.and have_link("d/README.md#id", href: project_blob_path(project, "markdown/db/README.md", anchor: "id"))
end end
it "shows correct content of file" do it "shows correct content of file" do
...@@ -114,10 +110,10 @@ RSpec.describe "User browses files" do ...@@ -114,10 +110,10 @@ RSpec.describe "User browses files" do
expect(current_path).to eq(project_blob_path(project, "markdown/doc/api/README.md")) expect(current_path).to eq(project_blob_path(project, "markdown/doc/api/README.md"))
expect(page).to have_content("All API requests require authentication") expect(page).to have_content("All API requests require authentication")
.and have_content("Contents") .and have_content("Contents")
.and have_link("Users") .and have_link("Users")
.and have_link("Rake tasks") .and have_link("Rake tasks")
.and have_header_with_correct_id_and_link(1, "GitLab API", "gitlab-api") .and have_header_with_correct_id_and_link(1, "GitLab API", "gitlab-api")
click_link("Users") click_link("Users")
...@@ -148,16 +144,13 @@ RSpec.describe "User browses files" do ...@@ -148,16 +144,13 @@ RSpec.describe "User browses files" do
click_link("d") click_link("d")
end end
# rubocop:disable Lint/Void expect(page).to have_link("..", href: project_tree_path(project, "markdown/"))
# Test the full URLs of links instead of relative paths by `have_link(text: "...", href: "...")`.
find("a", text: "..")["href"] == project_tree_url(project, "markdown/d")
# rubocop:enable Lint/Void
page.within(".tree-table") do page.within(".tree-table") do
click_link("README.md") click_link("README.md")
end end
# Test the full URLs of links instead of relative paths by `have_link(text: "...", href: "...")`.
find("a", text: /^empty$/)["href"] == project_blob_url(project, "markdown/d/README.md") expect(page).to have_link("empty", href: "")
end end
it "shows correct content of directory" do it "shows correct content of directory" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment