Commit a1b288e2 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'leaky-constant-fix-16' into 'master'

Stub class in tree spec

See merge request gitlab-org/gitlab!32045
parents e6442cb3 56f3375d
......@@ -387,7 +387,6 @@ RSpec/LeakyConstantDeclaration:
- 'spec/models/concerns/reactive_caching_spec.rb'
- 'spec/models/concerns/triggerable_hooks_spec.rb'
- 'spec/models/repository_spec.rb'
- 'spec/models/tree_spec.rb'
- 'spec/policies/merge_request_policy_spec.rb'
- 'spec/requests/api/graphql/tasks/task_completion_status_spec.rb'
- 'spec/rubocop/cop/rspec/env_assignment_spec.rb'
......
---
title: Fix leaky constant issue in tree spec
merge_request: 32045
author: Rajendra Kadam
type: fixed
......@@ -9,15 +9,18 @@ describe Tree do
subject { described_class.new(repository, '54fcc214') }
describe '#readme' do
class FakeBlob
attr_reader :name
def initialize(name)
@name = name
end
def readme?
name =~ /^readme/i
before do
stub_const('FakeBlob', Class.new)
FakeBlob.class_eval do
attr_reader :name
def initialize(name)
@name = name
end
def readme?
name =~ /^readme/i
end
end
end
......
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