<commit_before>dir = File.dirname(__FILE__)
require "#{dir}/../example_helper"

module RR
describe MockCreator, :shared => true do
  before(:each) do
    @space = Space.new
    @subject = Object.new
  end

  it "initializes creator with passed in object" do
    class << @creator
      attr_reader :subject
    end
    @creator.subject.should === @subject
  end
end

describe MockCreator, ".new without block" do
  it_should_behave_like "RR::MockCreator"

  before do
    @creator = MockCreator.new(@space, @subject)
  end
end

describe MockCreator, ".new with block" do
  it_should_behave_like "RR::MockCreator"

  before do
    @creator = MockCreator.new(@space, @subject) do |c|
      c.foobar(1, 2) {:one_two}
      c.foobar(1) {:one}
      c.foobar.with_any_args {:default}
      c.baz() {:baz_result}
    end
  end

  it "creates doubles" do
    @subject.foobar(1, 2).should == :one_two
    @subject.foobar(1).should == :one
    @subject.foobar(:something).should == :default
    @subject.baz.should == :baz_result
  end
end


describe MockCreator, "#method_missing" do
  it_should_behave_like "RR::MockCreator"
  
  before do
    @subject = Object.new
    @creator = MockCreator.new(@space, @subject)
  end

  it "sets expectations on the subject" do
    @creator.foobar(1, 2) {:baz}.twice

    @subject.foobar(1, 2).should == :baz
    @subject.foobar(1, 2).should == :baz
    proc {@subject.foobar(1, 2)}.should raise_error(Expectations::TimesCalledExpectationError)
#    proc {@subject.foobar(1)}.should raise_error(Expectations::ArgumentEqualityExpectationError)
  end
end

end<commit_msg>Remove extraneous comment.<commit_after>dir = File.dirname(__FILE__)
require "#{dir}/../example_helper"

module RR
describe MockCreator, :shared => true do
  before(:each) do
    @space = Space.new
    @subject = Object.new
  end

  it "initializes creator with passed in object" do
    class << @creator
      attr_reader :subject
    end
    @creator.subject.should === @subject
  end
end

describe MockCreator, ".new without block" do
  it_should_behave_like "RR::MockCreator"

  before do
    @creator = MockCreator.new(@space, @subject)
  end
end

describe MockCreator, ".new with block" do
  it_should_behave_like "RR::MockCreator"

  before do
    @creator = MockCreator.new(@space, @subject) do |c|
      c.foobar(1, 2) {:one_two}
      c.foobar(1) {:one}
      c.foobar.with_any_args {:default}
      c.baz() {:baz_result}
    end
  end

  it "creates doubles" do
    @subject.foobar(1, 2).should == :one_two
    @subject.foobar(1).should == :one
    @subject.foobar(:something).should == :default
    @subject.baz.should == :baz_result
  end
end


describe MockCreator, "#method_missing" do
  it_should_behave_like "RR::MockCreator"
  
  before do
    @subject = Object.new
    @creator = MockCreator.new(@space, @subject)
  end

  it "sets expectations on the subject" do
    @creator.foobar(1, 2) {:baz}.twice

    @subject.foobar(1, 2).should == :baz
    @subject.foobar(1, 2).should == :baz
    proc {@subject.foobar(1, 2)}.should raise_error(Expectations::TimesCalledExpectationError)
  end
end

end
{'fraction_non_alphanumeric': 0.1288146482492772, 'fraction_numerical': 0.009315772566655958, 'mean_word_length': 3.62704309063893, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '2537625', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1073, 'n_words': 260}