Commit 56f3375d authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Peter Leitzen

Stub class in tree spec

parent d194f3dc
......@@ -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/requests/api/statistics_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