{"id":15240472,"url":"https://github.com/chuyeow/facon","last_synced_at":"2025-04-10T13:42:57.596Z","repository":{"id":384200,"uuid":"1425","full_name":"chuyeow/facon","owner":"chuyeow","description":"Facon is a mocking library in the spirit of the Bacon spec library. Small, compact, and works with Bacon.","archived":false,"fork":false,"pushed_at":"2020-06-30T23:59:18.000Z","size":59,"stargazers_count":37,"open_issues_count":0,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T12:21:46.375Z","etag":null,"topics":["mock-library","rspec","ruby"],"latest_commit_sha":null,"homepage":"http://rubyforge.org/projects/facon/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chuyeow.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.txt","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2008-02-27T09:18:51.000Z","updated_at":"2022-01-08T03:33:23.000Z","dependencies_parsed_at":"2022-07-04T12:33:37.444Z","dependency_job_id":null,"html_url":"https://github.com/chuyeow/facon","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chuyeow%2Ffacon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chuyeow%2Ffacon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chuyeow%2Ffacon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chuyeow%2Ffacon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chuyeow","download_url":"https://codeload.github.com/chuyeow/facon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247774024,"owners_count":20993691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mock-library","rspec","ruby"],"created_at":"2024-09-29T11:05:08.979Z","updated_at":"2025-04-10T13:42:57.579Z","avatar_url":"https://github.com/chuyeow.png","language":"Ruby","readme":"Facon\n=====\n\nFacon is a mocking library in the spirit of the [Bacon](https://github.com/chneukirchen/bacon) spec library. Small, compact, and works with [Bacon](https://github.com/chneukirchen/bacon) and [MacBacon](https://github.com/alloy/MacBacon).\n\n[![Build Status](https://travis-ci.org/chuyeow/facon.png)](https://travis-ci.org/chuyeow/facon)\n\n[![Coverage Status](https://coveralls.io/repos/chuyeow/facon/badge.png)](https://coveralls.io/r/chuyeow/facon)\n\nSynopsis\n--------\n\nTo use Facon with [Bacon](https://github.com/chneukirchen/bacon), simply `require 'facon'` and you're done.\n\nYou can now write [Bacon](https://github.com/chneukirchen/bacon) specs like this (in RSpec-like style):\n\n```ruby\n  require 'bacon'\n  require 'facon'\n\n  describe 'PersonController' do\n    before do\n      @konata = mock('konata', :id =\u003e 1, :name =\u003e 'Konata Izumi')\n      @kagami = mock('kagami', :id =\u003e 2, :name =\u003e 'Kagami Hiiragi')\n    end\n\n    it \"should find all people on GET to 'index'\" do\n      Person.should.receive(:find).with(:all).and_return([@konata, @kagami])\n\n      get('/people/index')\n    end\n\n    it \"should find the person with id of 1 on Get to 'show/1'\" do\n      Person.should.receive(:find).with(1).and_return(@konata)\n\n      get('/people/show/1')\n    end\n\n    it \"knows how many times we call a method\" do\n      Person.should.receive(:find).at_least(3)\n\n      Person.list\n    end\n\n    it \"can use at_most\" do\n      Person.should.receive(:find).at_most(3)\n\n      Person.list\n    end\n  end\n```\n\nFor now, more examples can be found in the specs included with the Facon gem. I promise to get better examples into the documentation!\n\nSee Facon::Baconize for more documentation on using Facon with [Bacon](https://github.com/chneukirchen/bacon).\n\nRequirements\n------------\n\n* Ruby (check [Travis CI builds](https://travis-ci.org/chuyeow/facon) for which versions are supported)\n* [Bacon](https://github.com/chneukirchen/bacon) (optional, required for running specs)\n\nCompatibility with Bacon\n------------------------\n\nWhen used with Bacon, Facon uses some Bacon hooks, which unfortunately causes some compatibility issues with new versions of Bacon. Use this compatibility chart to find out which versions of Facon to install when running with Bacon.\n\n```\nFacon version -- Bacon version\n\u003c= 0.3.x      -- 0.9 (only tested with 0.9 but might work with earlier versions of Bacon)\n0.4           -- 1.0, 1.1\n```\n\nInstallation\n------------\n\nSimply install the gem:\n  `gem install facon`\n\nOr add it to your Gemfile:\n  `gem 'facon'`\n\nThe Source Code\n---------------\n\nYou can get the latest trunk from the Git repository on Github:\n  \u003chttps://github.com/chuyeow/facon\u003e\n\nTodos\n-----\n\n* test/unit and RSpec integration.\n* Remove the `$facon_mocks` global.\n* Throw away unnecessary code.\n* Implement `exactly` expectation.\n\nContributors\n------------\n\n* [James Tucker](https://github.com/raggi) for #times, #once, #never expectation matchers.\n* [Peter Kim](https://github.com/petejkim) for [MacBacon](https://github.com/alloy/MacBacon) support.\n* [Yossef Mendelssohn](https://github.com/ymendel) for Ruby 1.9.2 compatibility fixes.\n* [Ivan Acosta-Rubio](https://github.com/ivanacostarubio) for at_most and at_least expectations.\n\nThanks to\n---------\n\n* [RSpec](http://rspec.info/) for creating spec/mocks, from which a lot of the code for Facon is stolen.\n* [Christian Neukirchen]((https://github.com/chneukirchen) for creating Bacon.\n\nLicense\n-------\n\n(The MIT License)\n\nCopyright (c) 2008 Cheah Chu Yeow\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/chuyeow/facon/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n[![Analytics](https://ga-beacon.appspot.com/UA-46828034-1/facon/readme)](https://github.com/igrigorik/ga-beacon)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchuyeow%2Ffacon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchuyeow%2Ffacon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchuyeow%2Ffacon/lists"}