summaryrefslogtreecommitdiff
path: root/spec/rubocop/cop/put_project_routes_under_scope_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /spec/rubocop/cop/put_project_routes_under_scope_spec.rb
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
downloadgitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/rubocop/cop/put_project_routes_under_scope_spec.rb')
-rw-r--r--spec/rubocop/cop/put_project_routes_under_scope_spec.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/spec/rubocop/cop/put_project_routes_under_scope_spec.rb b/spec/rubocop/cop/put_project_routes_under_scope_spec.rb
index 66e9044c453..05e1cd7b693 100644
--- a/spec/rubocop/cop/put_project_routes_under_scope_spec.rb
+++ b/spec/rubocop/cop/put_project_routes_under_scope_spec.rb
@@ -9,19 +9,20 @@ RSpec.describe RuboCop::Cop::PutProjectRoutesUnderScope, type: :rubocop do
subject(:cop) { described_class.new }
- before do
- allow(cop).to receive(:in_project_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 '-' do
resource :issues
end
- resource :notes
- ^^^^^^^^^^^^^^^ Put new project routes under /-/ scope
- PATTERN
+ #{offense}
+ #{marker} Put new project routes under /-/ scope
+ PATTERN
+ end
end
it 'does not register an offense when resource inside the scope' do