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,7 +9,9 @@ describe Tree do
subject { described_class.new(repository, '54fcc214') }
describe '#readme' do
class FakeBlob
before do
stub_const('FakeBlob', Class.new)
FakeBlob.class_eval do
attr_reader :name
def initialize(name)
......@@ -20,6 +22,7 @@ describe Tree do
name =~ /^readme/i
end
end
end
it 'returns nil when repository does not contains a README file' do
files = [FakeBlob.new('file'), FakeBlob.new('license'), FakeBlob.new('copying')]
......
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