communist 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -2
- data/README.md +16 -0
- data/communist.gemspec +1 -0
- data/lib/communist/cucumber.rb +0 -1
- data/lib/communist/null_server.rb +2 -0
- data/lib/communist/server.rb +8 -1
- data/lib/communist/version.rb +1 -1
- data/spec/server_spec.rb +1 -1
- metadata +21 -10
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
-
0.
|
2
|
-
|
1
|
+
0.3.0 (Sept 22, 2012)
|
2
|
+
=====================
|
3
|
+
|
4
|
+
* Add ability to handle json response bodies.
|
5
|
+
* Remove init signal trapping.
|
6
|
+
* Update docs with further examples.
|
7
|
+
|
8
|
+
0.2.0 (Aug 26, 2012)
|
9
|
+
====================
|
3
10
|
|
4
11
|
* Add NullServer.
|
5
12
|
* Add Constants.
|
data/README.md
CHANGED
@@ -51,6 +51,22 @@ Scenario: Get blob
|
|
51
51
|
Then the exit status should be 0
|
52
52
|
```
|
53
53
|
|
54
|
+
Further, by including `aruba` cucumber steps and using `sinatra` dsl you can easily describe canned responses:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
Scenario: List watchers
|
58
|
+
Given the GitHub API server:
|
59
|
+
"""
|
60
|
+
get('/repos/wycats/thor/subscribers') {
|
61
|
+
body :login => 'octokit', :id => 1,
|
62
|
+
:url => 'https://api.github.com/users/peter-murach'
|
63
|
+
status 200
|
64
|
+
}
|
65
|
+
"""
|
66
|
+
When I successfully run `gcli watch ls wycats thor`
|
67
|
+
Then the stdout should contain "octokit"
|
68
|
+
```
|
69
|
+
|
54
70
|
## Contributing
|
55
71
|
|
56
72
|
1. Fork it
|
data/communist.gemspec
CHANGED
data/lib/communist/cucumber.rb
CHANGED
data/lib/communist/server.rb
CHANGED
@@ -3,6 +3,7 @@ require 'thread'
|
|
3
3
|
require 'sinatra/base'
|
4
4
|
require 'net/http'
|
5
5
|
require 'communist'
|
6
|
+
require 'json'
|
6
7
|
|
7
8
|
module Communist
|
8
9
|
class Server
|
@@ -67,7 +68,6 @@ module Communist
|
|
67
68
|
@server_thread = Thread.new do
|
68
69
|
Communist.run_default_server(Identify.new(app), port) do |server|
|
69
70
|
Communist.servers[app.object_id] = server
|
70
|
-
trap "INT" do server.shutdown end
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -108,6 +108,13 @@ module Communist
|
|
108
108
|
nil
|
109
109
|
end
|
110
110
|
end
|
111
|
+
|
112
|
+
after do
|
113
|
+
if !response.body.empty?
|
114
|
+
content_type :json
|
115
|
+
body JSON.generate(response.body)
|
116
|
+
end
|
117
|
+
end
|
111
118
|
end
|
112
119
|
|
113
120
|
new(app).start
|
data/lib/communist/version.rb
CHANGED
data/spec/server_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: communist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
16
|
-
requirement: &
|
16
|
+
requirement: &2151864960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,21 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2151864960
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: json
|
27
|
+
requirement: &2151863860 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2151863860
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: sinatra
|
27
|
-
requirement: &
|
38
|
+
requirement: &2151863020 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ! '>='
|
@@ -32,10 +43,10 @@ dependencies:
|
|
32
43
|
version: '0'
|
33
44
|
type: :runtime
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *2151863020
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: rspec
|
38
|
-
requirement: &
|
49
|
+
requirement: &2151862380 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ! '>='
|
@@ -43,10 +54,10 @@ dependencies:
|
|
43
54
|
version: '0'
|
44
55
|
type: :development
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *2151862380
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: rake
|
49
|
-
requirement: &
|
60
|
+
requirement: &2151861760 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ! '>='
|
@@ -54,7 +65,7 @@ dependencies:
|
|
54
65
|
version: '0'
|
55
66
|
type: :development
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *2151861760
|
58
69
|
description: Library for mocking CLI calls to external APIs
|
59
70
|
email:
|
60
71
|
- ''
|