Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Cucumber for Web Services

branch: master
Octocat-spinner-32 lib use better port finding logic September 28, 2011
Octocat-spinner-32 spec more specs September 03, 2011
Octocat-spinner-32 .gitignore add install toplevel September 03, 2011
Octocat-spinner-32 Gemfile basic structure September 03, 2011
Octocat-spinner-32 Gemfile.lock add spec stub September 03, 2011
Octocat-spinner-32 LICENSE basic structure September 03, 2011
Octocat-spinner-32 README.md Edited README.md via GitHub September 04, 2011
Octocat-spinner-32 Rakefile basic structure September 03, 2011
Octocat-spinner-32 antilles.gemspec basic structure September 03, 2011
README.md

Antilles

Overview

Antilles forks a stub HTTP server using mimic and exposes a simple interface to configure the server. Antilles is meant to work with aruba to make it easier to test command line tools that communicate with Web APIs.

Read this blog post for our motivation.

Installation

Antilles works best with cucumber and aruba, but it can be used with any testing tool.

Install the gem:

  gem install antilles

or use bundler:

  group :test do
    gem :antilles
  end

Set up environment, for example with cucumber:

  # features/support/antilles.rb
  require 'antilles/cucumber'

  Antilles.configure do |server|
    server.port = 9876   # defaults to 8080
    server.log = STDOUT  # defaults to nil for no logging
  end

Requiring antilles/cucumber will automatically start a server before all Scenarios tagged @mimic, clear stubs between tests, and tear down the server when the test exits. Look at cucumber.rb if you need to customize this behavior.

Usage

Antilles can be configured to do anything mimic can do, but the basic mode of operation is to install stubs:

Given /^creating a membership fails with: (.*)$/ do |error|
  user="a@b.com"
  Antilles.install(:post, "/memberships/#{user}", {:status=>1, :explanation=>error}, :code=>409)
end
Something went wrong with that request. Please try again.