Giter Site home page Giter Site logo

mocha's Introduction

= Mocha

Mocha is a library for mocking and stubbing using a syntax like that of JMock[http://www.jmock.org].

It can be used with many testing frameworks e.g. Test::Unit[http://www.ruby-doc.org/core/classes/Test/Unit.html], RSpec[http://rspec.info/], test/spec[http://chneukirchen.org/repos/testspec/README], expectations[http://expectations.rubyforge.org/], Dust[http://dust.rubyforge.org/], MiniTest[http://rubyforge.org/projects/bfts] and even JtestR[http://jtestr.codehaus.org/].

Mocha provides a unified, simple and readable syntax for both traditional mocking and partial mocking.

Mocha was harvested from projects at Reevoo[http://www.reevoo.com] by me (James[http://blog.floehopper.org]) and my (then) colleagues Ben[http://www.techbelly.com/], Chris[http://chrisroos.co.uk] and Paul[http://po-ru.com].

== Download and Installation

Install the gem with the following command...

  $ gem install mocha

Or install the Rails[http://www.rubyonrails.org] plugin...

  $ script/plugin install git://github.com/floehopper/mocha.git

Note that versions 0.9.6 & 0.9.7 of the Rails plugin were broken. As of version 0.9.8, you need to explicitly load Mocha after the test framework e.g. by adding "require 'mocha'" at the bottom of test/test_helper.rb.

Or download Mocha...

  http://rubyforge.org/frs/?group_id=1917

== Examples

* Quick Start - {Usage Examples}[link:examples/misc.html]
* Traditional mocking - {Star Trek Example}[link:examples/mocha.html]
* Setting expectations on real classes - {Order Example}[link:examples/stubba.html]
* More examples on {Floehopper's Blog}[http://blog.floehopper.org]
* {Mailing List Archives}[http://groups.google.com/group/mocha-developer]

== 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://mocha.rubyforge.org/files/MIT-LICENSE.html].

mocha's People

Contributors

bira avatar dan-manges avatar denisdefreyne avatar floehopper avatar sprsquish avatar taylorbarstow avatar thewoolleyman avatar threedaymonk avatar tinogomes avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.