diff options
Diffstat (limited to 'spec/models/tree_spec.rb')
-rw-r--r-- | spec/models/tree_spec.rb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/spec/models/tree_spec.rb b/spec/models/tree_spec.rb index c2d5dfdf9c4..7dde8459f9a 100644 --- a/spec/models/tree_spec.rb +++ b/spec/models/tree_spec.rb @@ -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 |