Commit 491801ef authored by Katrin Leinweber's avatar Katrin Leinweber

Stop using UrlHelper includes in specs

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/341401
parent 007ad73d
---
Rails/IncludeUrlHelper:
Exclude:
- ee/spec/helpers/ee/projects/security/configuration_helper_spec.rb
- ee/spec/lib/banzai/filter/cross_project_issuable_information_filter_spec.rb
- spec/helpers/merge_requests_helper_spec.rb
- spec/helpers/nav/top_nav_helper_spec.rb
- spec/helpers/notify_helper_spec.rb
- spec/lib/banzai/filter/reference_redactor_filter_spec.rb
- spec/lib/banzai/reference_redactor_spec.rb
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe EE::Projects::Security::ConfigurationHelper do RSpec.describe EE::Projects::Security::ConfigurationHelper do
include ActionView::Helpers::UrlHelper
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Banzai::Filter::CrossProjectIssuableInformationFilter do RSpec.describe Banzai::Filter::CrossProjectIssuableInformationFilter do
include ActionView::Helpers::UrlHelper
include FilterSpecHelper include FilterSpecHelper
let(:user) { create(:user) } let(:user) { create(:user) }
...@@ -13,7 +12,7 @@ RSpec.describe Banzai::Filter::CrossProjectIssuableInformationFilter do ...@@ -13,7 +12,7 @@ RSpec.describe Banzai::Filter::CrossProjectIssuableInformationFilter do
def create_link(issuable) def create_link(issuable)
type = issuable.class.name.underscore.downcase type = issuable.class.name.underscore.downcase
link_to(issuable.to_reference, '', ActionController::Base.helpers.link_to(issuable.to_reference, '',
class: 'gfm has-tooltip', class: 'gfm has-tooltip',
title: issuable.title, title: issuable.title,
data: { data: {
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe MergeRequestsHelper do RSpec.describe MergeRequestsHelper do
include ActionView::Helpers::UrlHelper
include ProjectForksHelper include ProjectForksHelper
describe '#state_name_with_icon' do describe '#state_name_with_icon' do
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Nav::TopNavHelper do RSpec.describe Nav::TopNavHelper do
include ActionView::Helpers::UrlHelper
let_it_be(:user) { build_stubbed(:user) } let_it_be(:user) { build_stubbed(:user) }
let_it_be(:admin) { build_stubbed(:user, :admin) } let_it_be(:admin) { build_stubbed(:user, :admin) }
let_it_be(:external_user) { build_stubbed(:user, :external, can_create_group: false) } let_it_be(:external_user) { build_stubbed(:user, :external, can_create_group: false) }
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe NotifyHelper do RSpec.describe NotifyHelper do
include ActionView::Helpers::UrlHelper
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
describe 'merge_request_reference_link' do describe 'merge_request_reference_link' do
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Banzai::Filter::ReferenceRedactorFilter do RSpec.describe Banzai::Filter::ReferenceRedactorFilter do
include ActionView::Helpers::UrlHelper
include FilterSpecHelper include FilterSpecHelper
it 'ignores non-GFM links' do it 'ignores non-GFM links' do
...@@ -14,7 +13,7 @@ RSpec.describe Banzai::Filter::ReferenceRedactorFilter do ...@@ -14,7 +13,7 @@ RSpec.describe Banzai::Filter::ReferenceRedactorFilter do
end end
def reference_link(data) def reference_link(data)
link_to('text', '', class: 'gfm', data: data) ActionController::Base.helpers.link_to('text', '', class: 'gfm', data: data)
end end
it 'skips when the skip_redaction flag is set' do it 'skips when the skip_redaction flag is set' do
......
...@@ -106,13 +106,12 @@ RSpec.describe Banzai::ReferenceRedactor do ...@@ -106,13 +106,12 @@ RSpec.describe Banzai::ReferenceRedactor do
end end
context 'when the user cannot read cross project' do context 'when the user cannot read cross project' do
include ActionView::Helpers::UrlHelper
let(:project) { create(:project) } let(:project) { create(:project) }
let(:other_project) { create(:project, :public) } let(:other_project) { create(:project, :public) }
def create_link(issuable) def create_link(issuable)
type = issuable.class.name.underscore.downcase type = issuable.class.name.underscore.downcase
link_to(issuable.to_reference, '', ActionController::Base.helpers.link_to(issuable.to_reference, '',
class: 'gfm has-tooltip', class: 'gfm has-tooltip',
title: issuable.title, title: issuable.title,
data: { data: {
......
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