antilles 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -2,13 +2,17 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- Antilles sets up a stub HTTP server using mimic and exposes a simple interface
6
- to configure the server. Antilles is meant to work with aruba to make it easier
7
- to test command line tools that communicate with Web APIs.
5
+ Antilles forks a stub HTTP server using
6
+ [mimic](https://github.com/lukeredpath/mimic) and exposes a simple interface to
7
+ configure the server. Antilles is meant to work with
8
+ [aruba](https://github.com/cucumber/aruba) to make it easier to
9
+ test command line tools that communicate with Web APIs.
10
+
11
+ Read this [blog post](http://blog.tddium.com/2011/09/04/antilles-testing-clis-that-use-web-services/) for our motivation.
8
12
 
9
13
  ## Installation
10
14
 
11
- Antilles works best with cucumber, but it can be used with any testing tool.
15
+ Antilles works best with cucumber and aruba, but it can be used with any testing tool.
12
16
 
13
17
  ### Install the gem:
14
18
 
@@ -20,7 +24,7 @@ Antilles works best with cucumber, but it can be used with any testing tool.
20
24
  gem :antilles
21
25
  end
22
26
 
23
- ### Set up environment:
27
+ ### Set up environment, for example with cucumber:
24
28
 
25
29
  # features/support/antilles.rb
26
30
  require 'antilles/cucumber'
@@ -31,7 +35,10 @@ Antilles works best with cucumber, but it can be used with any testing tool.
31
35
  end
32
36
 
33
37
  Requiring `antilles/cucumber` will automatically start a server before all
34
- Scenarios tagged `@mimic`, and tear down the server when the test exits.
38
+ Scenarios tagged `@mimic`, clear stubs between tests, and tear down the server
39
+ when the test exits. Look at [cucumber.rb]
40
+ (https://github.com/tddium/antilles/blob/master/lib/antilles/cucumber.rb) if you
41
+ need to customize this behavior.
35
42
 
36
43
  ## Usage
37
44
 
@@ -9,7 +9,7 @@ class Antilles
9
9
  attr_accessor :log
10
10
 
11
11
  def initialize(port=nil, log=nil)
12
- @port = port || 8080
12
+ @port = port || Antilles.find_available_port
13
13
  @pid_list = []
14
14
  @log = log
15
15
  end
@@ -116,6 +116,13 @@ class Antilles
116
116
  def install(*args)
117
117
  server.install(*args)
118
118
  end
119
+
120
+ def find_available_port
121
+ server = TCPServer.new('127.0.0.1', 0)
122
+ server.addr[1]
123
+ ensure
124
+ server.close if server
125
+ end
119
126
  end
120
127
  end
121
128
 
@@ -1,3 +1,3 @@
1
1
  module AntillesVersion
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: antilles
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.3
5
+ version: 0.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Solano Labs
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-03 00:00:00 -07:00
14
- default_executable:
13
+ date: 2011-09-28 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: json
@@ -115,7 +114,6 @@ files:
115
114
  - lib/antilles/version.rb
116
115
  - spec/antilles_spec.rb
117
116
  - spec/spec_helper.rb
118
- has_rdoc: true
119
117
  homepage: http://www.tddium.com/
120
118
  licenses: []
121
119
 
@@ -139,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
137
  requirements: []
140
138
 
141
139
  rubyforge_project: tddium
142
- rubygems_version: 1.6.2
140
+ rubygems_version: 1.8.10
143
141
  signing_key:
144
142
  specification_version: 3
145
143
  summary: Easy API Mimicing for Cucumber