{"id":18116652,"url":"https://github.com/piotrmurach/communist","last_synced_at":"2025-06-27T23:05:03.460Z","repository":{"id":3953997,"uuid":"5047109","full_name":"piotrmurach/communist","owner":"piotrmurach","description":"Library for mocking CLI calls to external APIs","archived":false,"fork":false,"pushed_at":"2016-05-15T16:02:17.000Z","size":28,"stargazers_count":25,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-16T09:00:58.876Z","etag":null,"topics":["acceptance-testing","cucumber","rspec-matchers","ruby-gem","testing"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"SimonRichardson/funk","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piotrmurach.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-14T12:04:41.000Z","updated_at":"2021-09-10T14:31:07.000Z","dependencies_parsed_at":"2022-09-16T04:52:14.838Z","dependency_job_id":null,"html_url":"https://github.com/piotrmurach/communist","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/piotrmurach/communist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrmurach%2Fcommunist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrmurach%2Fcommunist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrmurach%2Fcommunist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrmurach%2Fcommunist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piotrmurach","download_url":"https://codeload.github.com/piotrmurach/communist/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piotrmurach%2Fcommunist/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262347474,"owners_count":23296894,"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":["acceptance-testing","cucumber","rspec-matchers","ruby-gem","testing"],"created_at":"2024-11-01T04:12:45.628Z","updated_at":"2025-06-27T23:05:03.437Z","avatar_url":"https://github.com/piotrmurach.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Communist\n[![Gem Version](https://badge.fury.io/rb/communist.svg)][gem]\n[![Build Status](https://secure.travis-ci.org/piotrmurach/communist.svg?branch=master)][travis]\n[![Dependency Status](https://gemnasium.com/piotrmurach/communist.svg?travis)][gemnasium]\n[![Inline docs](http://inch-ci.org/github/piotrmurach/tty-command.svg?branch=master)][inchpages]\n\n[gem]: http://badge.fury.io/rb/communist\n[travis]: http://travis-ci.org/piotrmurach/communist\n[gemnasium]: https://gemnasium.com/piotrmurach/communist\n[inchpages]: http://inch-ci.org/github/piotrmurach/communist\n\nThe Manifesto:\n\n\u003e It is Communist prime role to serve community by providing Cucumber steps for\n\u003e testing external API calls from command line applications. To meet this aim\n\u003e the Communist employees Sinatra DSL for mocking server responses. The Communist\n\u003e server receives requests from CLI and provides an API to respond to those\n\u003e requests. Canned answers/expectations have to be provided upfront.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'communist'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install communist\n\n## Usage\n\nTo get started include the following in your cucumber environment file:\n\n```ruby\n# features/support/env.rb\nrequire 'communist/cucumber'\n```\n\nThe gem uses `ENV['TEST_HOST']` variable to instrument requests. In your command line application add the following logic to switch between live and test requests:\n\n```ruby\nif ENV['TEST_HOST']\n  @@api.endpoint = 'http://' + ENV['TEST_HOST']\nend\n```\n\nFinally, communist has few cucumber steps such as `Given ... server:` that help setting expectations such as:\n\n```ruby\nScenario: Get blob\n  Given the GitHub API server:\n  \"\"\"\n  get('/repos/wycats/thor/git/blobs/59b23de9b91d') { status 200 }\n  \"\"\"\n  When I run `ghub blob get wycats thor 59b23de9b91d`\n  Then the exit status should be 0\n```\n\nFurther, by including `aruba` cucumber steps and using `sinatra` dsl you can easily describe canned responses:\n\n```ruby\nScenario: List watchers\n  Given the GitHub API server:\n  \"\"\"\n  get('/repos/wycats/thor/subscribers') {\n    body :login =\u003e 'octokit', :id =\u003e 1,\n          :url =\u003e 'https://api.github.com/users/piotrmurach'\n    status 200\n  }\n  \"\"\"\n  When I successfully run `gcli watch ls wycats thor`\n  Then the stdout should contain \"octokit\"\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n## Copyright\n\nCopyright (c) 2012-2016 Piotr Murach. See LICENSE for further details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiotrmurach%2Fcommunist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiotrmurach%2Fcommunist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiotrmurach%2Fcommunist/lists"}