{"repo":"freerange/mocha","free":true,"listed":false,"github":"https://github.com/freerange/mocha","clone":"git clone https://github.com/freerange/mocha.git","description":"A mocking and stubbing library for Ruby","language":"Ruby","stars":1284,"topics":["ruby","minitest","test-unit","mock","stub","testing"],"license":null,"category":"dev-tools","readme_excerpt":"Mocha Description A Ruby library for mocking and stubbing - but deliberately not (yet) faking or spying. A unified, simple and readable syntax for both full & partial mocking. Built-in support for Minitest and Test::Unit. Supported by many other test frameworks. Intended Usage Mocha is intended to be used in unit tests for the Mock Object or Test Stub types of Test Double, not the Fake Object or Test Spy types. Although it would be possible to extend Mocha to allow the implementation of fakes and spies, we have chosen to keep it focused on mocks and stubs. Installation Gem Install the latest version of the gem with the following command... $ gem install mocha Note: If you are intending to use Mocha with Test::Unit or Minitest, you should only setup Mocha after loading the relevant test library... Test::Unit Minitest Bundler If you're using Bundler, include Mocha in the Gemfile and then setup Mocha later once you know the test library has been loaded... Test::Unit Minitest RSpec RSpec includes a mocha adapter. Just tell RSpec you want to mock with :mocha : Note: There is no need to use a require statement to setup Mocha; RSpec does this itself. Cucumber Rails If you're loading Mocha using Bundler within a Rails application, you should setup Mocha manually e.g. at the bottom of your test helper.rb . Minitest Note that since Rails v4 (at least), ActiveSupport::TestCase has inherited from Minitest::Test or its earlier equivalents. Thus unless you are explicitly using Test::Unit, ","default_branch":null,"files":null,"tree":[],"storefront":"/r/freerange","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/freerange/mocha/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}