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/put_group_routes_under_scope_spec.rb')
-rw-r--r--spec/rubocop/cop/put_group_routes_under_scope_spec.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/spec/rubocop/cop/put_group_routes_under_scope_spec.rb b/spec/rubocop/cop/put_group_routes_under_scope_spec.rb
index 2e577c9c578..c55d9bf22d6 100644
--- a/spec/rubocop/cop/put_group_routes_under_scope_spec.rb
+++ b/spec/rubocop/cop/put_group_routes_under_scope_spec.rb
@@ -9,19 +9,20 @@ RSpec.describe RuboCop::Cop::PutGroupRoutesUnderScope, type: :rubocop do
subject(:cop) { described_class.new }
- before do
- allow(cop).to receive(:in_group_routes?).and_return(true)
- end
+ %w[resource resources get post put patch delete].each do |route_method|
+ it "registers an offense when route is outside scope for `#{route_method}`" do
+ offense = "#{route_method} :notes"
+ marker = '^' * offense.size
- it 'registers an offense when route is outside scope' do
- expect_offense(<<~PATTERN)
+ expect_offense(<<~PATTERN)
scope(path: 'groups/*group_id/-', module: :groups) do
resource :issues
end
- resource :notes
- ^^^^^^^^^^^^^^^ Put new group routes under /-/ scope
- PATTERN
+ #{offense}
+ #{marker} Put new group routes under /-/ scope
+ PATTERN
+ end
end
it 'does not register an offense when resource inside the scope' do