<commit_before>## Mocha [![build status](https://secure.travis-ci.org/freerange/mocha.png)](https://secure.travis-ci.org/freerange/mocha.png)

### Description

A Ruby library for mocking and stubbing.

It has a unified, simple and readable syntax for both full & partial mocking.

It has built-in support for [MiniTest](https://github.com/seattlerb/minitest) and [Test::Unit](https://github.com/test-unit/test-unit/) and is supported by many other test frameworks, e.g. [RSpec](http://rspec.info/), [bacon](https://github.com/chneukirchen/bacon/), [expectations](http://expectations.rubyforge.org/), [Dust](http://dust.rubyforge.org/) and [JtestR](http://jtestr.codehaus.org/).

### Installation

#### Gem

Install the latest version of the gem with the following command...

    $ gem install mocha

Note that if you are intending to use Mocha with Test::Unit or MiniTest, you should only load Mocha *after* loading the relevant test library...

    require "test/unit"
    require "mocha"

#### Bundler

If you're using Bundler, ensure the correct load order by not auto-requiring Mocha in the `Gemfile` and then load it later once you know the test library has been loaded...

    # Gemfile
    gem "mocha", :require => false

    # Elsewhere after Bundler has loaded gems
    require "test/unit"
    require "mocha"

#### Rails

If you're loading Mocha using Bundler within a Rails application, you should ensure Mocha is not auto-required (as above) and load Mocha manually e.g. at the bottom of your `test_helper.rb`.

    # Gemfile in Rails app
    gem "mocha", :require => false

    # At bottom of test_helper.rb
    require "mocha"

#### Rails Plugin

Install the Rails plugin...

    $ rails plugin install git://github.com/freerange/mocha.git

Note that as of version 0.9.8, the Mocha plugin is not automatically loaded at plugin load time. Instead it must be manually loaded e.g. at the bottom of your `test_helper.rb`.

#### Know Issues

* Versions 0.10.2, 0.10.3 & 0.11.0 of the gem were broken.
* Versions 0.9.6 & 0.9.7 of the Rails plugin were broken.
* Please do not use these versions.

### Examples

* Quick Start - {file:misc.rb Usage Examples}
* Traditional mocking - {file:mocha.rb Star Trek Example}
* Setting expectations on real classes - {file:stubba.rb Order Example}
* More examples on [James Mead's Blog](http://jamesmead.org/blog/)
* [Mailing List Archives](http://groups.google.com/group/mocha-developer)

### Links

* [Source code](http://github.com/freerange/mocha)
* [Bug reports](http://github.com/freerange/mocha/issues)

### Developing Mocha

* Fork the repository.
* Make your changes in a branch (including tests).
* Ensure all of the tests run against all supported versions of Test::Unit, MiniTest & Ruby by running ./build-matrix.rb (note that currently this makes a *lot* of assumptions about your local environment e.g. rbenv installed with specific Ruby versions).
* Send us a pull request from your fork/branch.

### History

Mocha was initially harvested from projects at [Reevoo](http://www.reevoo.com/). It's syntax is heavily based on that of [jMock](http://www.jmock.org).

### Authors

* [<NAME>](http://jamesmead.org/)
* [<NAME>](http://www.techbelly.com/)
* [<NAME>](http://chrisroos.co.uk/)
* [<NAME>](http://po-ru.com/)
* [<NAME>](http://thewoolleyweb.com/)
* [<NAME>](http://www.dan-manges.com/)
* [<NAME>](http://stoneship.org/)
* [<NAME>](http://plentz.org/)
* [<NAME>](http://soup.superalloy.nl/)
* [<NAME>](https://github.com/glebpom)
* [<NAME>](https://github.com/meineerde)
* [<NAME>](https://github.com/jsanders)
* [<NAME>](https://github.com/sprsquish)
* [<NAME>](https://github.com/jigfox)
* [<NAME>](https://github.com/viking)
* [<NAME>](http://julik.nl/)
* [<NAME>](http://lukeredpath.co.uk/)
* [<NAME>](https://github.com/nicklewis)
* [<NAME>](http://sikachu.com/)
* [<NAME>](http://techblog.gomockingbird.com/)
* [<NAME>](https://github.com/sander6)
* [<NAME>](http://stevenxu.ca/)
* [<NAME>](http://taylorbarstow.com/)
* [<NAME>](https://github.com/Bira)
* [<NAME>](http://www.troutwine.us/)
* [<NAME>](https://github.com/reddavis)
* [<NAME>](http://blog.tinogomes.com/)

### License

© Copyright Revieworld Ltd. 2006

You may use, copy and redistribute this library under the same terms as [Ruby itself](http://www.ruby-lang.org/en/LICENSE.txt) or under the [MIT license](http://www.opensource.org/licenses/MIT).<commit_msg>Use HTML entity for copyright symbol which is allowed in markdown.<commit_after>## Mocha [![build status](https://secure.travis-ci.org/freerange/mocha.png)](https://secure.travis-ci.org/freerange/mocha.png)

### Description

A Ruby library for mocking and stubbing.

It has a unified, simple and readable syntax for both full & partial mocking.

It has built-in support for [MiniTest](https://github.com/seattlerb/minitest) and [Test::Unit](https://github.com/test-unit/test-unit/) and is supported by many other test frameworks, e.g. [RSpec](http://rspec.info/), [bacon](https://github.com/chneukirchen/bacon/), [expectations](http://expectations.rubyforge.org/), [Dust](http://dust.rubyforge.org/) and [JtestR](http://jtestr.codehaus.org/).

### Installation

#### Gem

Install the latest version of the gem with the following command...

    $ gem install mocha

Note that if you are intending to use Mocha with Test::Unit or MiniTest, you should only load Mocha *after* loading the relevant test library...

    require "test/unit"
    require "mocha"

#### Bundler

If you're using Bundler, ensure the correct load order by not auto-requiring Mocha in the `Gemfile` and then load it later once you know the test library has been loaded...

    # Gemfile
    gem "mocha", :require => false

    # Elsewhere after Bundler has loaded gems
    require "test/unit"
    require "mocha"

#### Rails

If you're loading Mocha using Bundler within a Rails application, you should ensure Mocha is not auto-required (as above) and load Mocha manually e.g. at the bottom of your `test_helper.rb`.

    # Gemfile in Rails app
    gem "mocha", :require => false

    # At bottom of test_helper.rb
    require "mocha"

#### Rails Plugin

Install the Rails plugin...

    $ rails plugin install git://github.com/freerange/mocha.git

Note that as of version 0.9.8, the Mocha plugin is not automatically loaded at plugin load time. Instead it must be manually loaded e.g. at the bottom of your `test_helper.rb`.

#### Know Issues

* Versions 0.10.2, 0.10.3 & 0.11.0 of the gem were broken.
* Versions 0.9.6 & 0.9.7 of the Rails plugin were broken.
* Please do not use these versions.

### Examples

* Quick Start - {file:misc.rb Usage Examples}
* Traditional mocking - {file:mocha.rb Star Trek Example}
* Setting expectations on real classes - {file:stubba.rb Order Example}
* More examples on [James Mead's Blog](http://jamesmead.org/blog/)
* [Mailing List Archives](http://groups.google.com/group/mocha-developer)

### Links

* [Source code](http://github.com/freerange/mocha)
* [Bug reports](http://github.com/freerange/mocha/issues)

### Developing Mocha

* Fork the repository.
* Make your changes in a branch (including tests).
* Ensure all of the tests run against all supported versions of Test::Unit, MiniTest & Ruby by running ./build-matrix.rb (note that currently this makes a *lot* of assumptions about your local environment e.g. rbenv installed with specific Ruby versions).
* Send us a pull request from your fork/branch.

### History

Mocha was initially harvested from projects at [Reevoo](http://www.reevoo.com/). It's syntax is heavily based on that of [jMock](http://www.jmock.org).

### Authors

* [<NAME>](http://jamesmead.org/)
* [<NAME>](http://www.techbelly.com/)
* [<NAME>](http://chrisroos.co.uk/)
* [<NAME>](http://po-ru.com/)
* [<NAME>](http://thewoolleyweb.com/)
* [<NAME>](http://www.dan-manges.com/)
* [<NAME>](http://stoneship.org/)
* [<NAME>](http://plentz.org/)
* [<NAME>](http://soup.superalloy.nl/)
* [<NAME>](https://github.com/glebpom)
* [<NAME>](https://github.com/meineerde)
* [<NAME>](https://github.com/jsanders)
* [<NAME>](https://github.com/sprsquish)
* [<NAME>](https://github.com/jigfox)
* [<NAME>](https://github.com/viking)
* [<NAME>](http://julik.nl/)
* [<NAME>](http://lukeredpath.co.uk/)
* [<NAME>](https://github.com/nicklewis)
* [<NAME>](http://sikachu.com/)
* [<NAME>](http://techblog.gomockingbird.com/)
* [<NAME>](https://github.com/sander6)
* [<NAME>](http://stevenxu.ca/)
* [<NAME>](http://taylorbarstow.com/)
* [<NAME>](https://github.com/Bira)
* [<NAME>](http://www.troutwine.us/)
* [<NAME>](https://github.com/reddavis)
* [<NAME>](http://blog.tinogomes.com/)

### License

&copy; Copyright Revieworld Ltd. 2006

You may use, copy and redistribute this library under the same terms as [Ruby itself](http://www.ruby-lang.org/en/LICENSE.txt) or under the [MIT license](http://www.opensource.org/licenses/MIT).
{'fraction_non_alphanumeric': 0.16696791685494802, 'fraction_numerical': 0.00587437867148667, 'mean_word_length': 4.099654377880184, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 61, 'https://': 30, 'lorem ipsum': 0, 'www.': 14, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '996152', 'n_tokens_mistral': 3100, 'n_tokens_neox': 2875, 'n_words': 835}