<commit_before>
require 'muack/test'

describe Muack::AnyInstanceOf do
  should 'mock any_instance_of' do
    klass = Class.new
    any_instance_of(klass){ |instance| mock(instance).say{ true } }
    obj = klass.new
    obj.say              .should.eq true
    obj.respond_to?(:say).should.eq true
    Muack.verify         .should.eq true
    obj.respond_to?(:say).should.eq false
  end

  should 'proxy any_instance_of' do
    klass = Class.new{ def f; true; end }
    any_instance_of(klass){ |instance| proxy(instance).f }
    obj = klass.new
    obj.f.should.eq true
    Muack.verify.should.eq true
  end
end<commit_msg>test for any_instance_of with proxy with a block<commit_after>
require 'muack/test'

describe Muack::AnyInstanceOf do
  should 'mock any_instance_of' do
    klass = Class.new
    any_instance_of(klass){ |instance| mock(instance).say{ true } }
    obj = klass.new
    obj.say              .should.eq true
    obj.respond_to?(:say).should.eq true
    Muack.verify         .should.eq true
    obj.respond_to?(:say).should.eq false
  end

  should 'proxy any_instance_of' do
    klass = Class.new{ def f; true; end }
    any_instance_of(klass){ |instance| proxy(instance).f }
    obj = klass.new
    obj.f.should.eq true
    Muack.verify.should.eq true
  end

  should 'proxy any_instance_of with a block' do
    klass = Class.new{ def f; 0; end }
    any_instance_of(klass){ |instance| proxy(instance).f{ |i| i+1 } }
    obj = klass.new
    obj.f.should.eq 1
    Muack.verify.should.eq true
  end
end
{'fraction_non_alphanumeric': 0.1118421052631579, 'fraction_numerical': 0.001973684210526316, 'mean_word_length': 2.8604060913705585, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2462232', 'n_tokens_mistral': 525, 'n_tokens_neox': 532, 'n_words': 131}