Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubocop/cop/avoid_route_redirect_leading_slash_spec.rb')
-rw-r--r--spec/rubocop/cop/avoid_route_redirect_leading_slash_spec.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/spec/rubocop/cop/avoid_route_redirect_leading_slash_spec.rb b/spec/rubocop/cop/avoid_route_redirect_leading_slash_spec.rb
index 9e13a5278e3..c049528523e 100644
--- a/spec/rubocop/cop/avoid_route_redirect_leading_slash_spec.rb
+++ b/spec/rubocop/cop/avoid_route_redirect_leading_slash_spec.rb
@@ -5,19 +5,21 @@ require 'rubocop'
require_relative '../../../rubocop/cop/avoid_route_redirect_leading_slash'
RSpec.describe RuboCop::Cop::AvoidRouteRedirectLeadingSlash do
- include CopHelper
-
subject(:cop) { described_class.new }
before do
allow(cop).to receive(:in_routes?).and_return(true)
end
- it 'registers an offense when redirect has a leading slash' do
+ it 'registers an offense when redirect has a leading slash and corrects', :aggregate_failures do
expect_offense(<<~PATTERN)
root to: redirect("/-/route")
^^^^^^^^^^^^^^^^^^^^ Do not use a leading "/" in route redirects
PATTERN
+
+ expect_correction(<<~PATTERN)
+ root to: redirect("-/route")
+ PATTERN
end
it 'does not register an offense when redirect does not have a leading slash' do
@@ -25,8 +27,4 @@ RSpec.describe RuboCop::Cop::AvoidRouteRedirectLeadingSlash do
root to: redirect("-/route")
PATTERN
end
-
- it 'autocorrect `/-/route` to `-/route`' do
- expect(autocorrect_source('redirect("/-/route")')).to eq('redirect("-/route")')
- end
end