Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

communist

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

communist

  • 0.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Communist

The Manifesto:

It is Communist prime role to serve community by providing Cucumber steps for testing external API calls from command line applications. To meet this aim the Communist employees Sinatra DSL for mocking server responses. The Communist server receives requests from CLI and provides an API to respond to those requests. Canned answers/expectations have to be provided upfront.

Installation

Add this line to your application's Gemfile:

gem 'communist'

And then execute:

$ bundle

Or install it yourself as:

$ gem install communist

Usage

To get started include the following in your cucumber environment file:

# features/support/env.rb
require 'communist/cucumber'

The 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:

if ENV['TEST_HOST']
  @@api.endpoint = 'http://' + ENV['TEST_HOST']
end

Finally, communist has few cucumber steps such as Given ... server: that help setting expectations such as:

Scenario: Get blob
  Given the GitHub API server:
  """
  get('/repos/wycats/thor/git/blobs/59b23de9b91d') { status 200 }
  """
  When I run `ghub blob get wycats thor 59b23de9b91d`
  Then the exit status should be 0

Further, by including aruba cucumber steps and using sinatra dsl you can easily describe canned responses:

Scenario: List watchers
  Given the GitHub API server:
  """
  get('/repos/wycats/thor/subscribers') {
    body :login => 'octokit', :id => 1,
          :url => 'https://api.github.com/users/peter-murach'
    status 200
  }
  """
  When I successfully run `gcli watch ls wycats thor`
  Then the stdout should contain "octokit"

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright (c) 2012 Piotr Murach. See LICENSE for further details.

FAQs

Package last updated on 22 Sep 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc