mirage 2.0.0.alpha3 → 2.0.0.alpha4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -2
- data/VERSION +1 -1
- data/bin/mirage +1 -1
- data/features/client/clear.feature +1 -1
- data/features/client/mirage_client.feature +1 -1
- data/features/client/{set.feature → put.feature} +20 -11
- data/features/client/{track.feature → request.feature} +2 -2
- data/features/client/{peek.feature → response.feature} +12 -12
- data/features/client/save_and_revert.feature +1 -1
- data/features/server/prime.feature +5 -5
- data/features/server/requests/delete.feature +46 -0
- data/features/server/requests/get.feature +32 -0
- data/features/server/templates/delete.feature +47 -0
- data/features/server/{peek.feature → templates/get.feature} +0 -0
- data/features/server/{set.feature → templates/put/put.feature} +29 -19
- data/features/server/{set_default_response.feature → templates/put/put_as_default.feature} +1 -1
- data/features/server/{set_with_a_delay.feature → templates/put/put_with_delay.feature} +0 -0
- data/features/server/{set_with_a_pattern.feature → templates/put/put_with_pattern.feature} +14 -1
- data/features/server/{response_templates.feature → templates/put/put_with_substitutions.feature} +0 -0
- data/features/step_definitions/my_steps.rb +15 -15
- data/features/support/env.rb +1 -1
- data/lib/mirage/client.rb +21 -17
- data/lib/mirage/core.rb +12 -3
- data/lib/mirage/server.rb +17 -0
- data/lib/mirage/web.rb +4 -4
- data/lib/start_mirage.rb +12 -17
- data/mirage.gemspec +32 -25
- metadata +41 -51
- data/features/server/clear.feature +0 -93
- data/features/server/track_requests.feature +0 -71
- data/lib/mirage.rb +0 -18
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mirage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 2.0.0.
|
5
|
+
version: 2.0.0.alpha4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Leon Davis
|
@@ -10,23 +10,12 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-11 00:00:00 +01:00
|
14
14
|
default_executable: mirage
|
15
15
|
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
17
|
-
name: rack
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
|
-
requirements:
|
21
|
-
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.1.0
|
24
|
-
type: :runtime
|
25
|
-
prerelease: false
|
26
|
-
version_requirements: *id001
|
27
16
|
- !ruby/object:Gem::Dependency
|
28
17
|
name: sinatra
|
29
|
-
requirement: &
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
30
19
|
none: false
|
31
20
|
requirements:
|
32
21
|
- - ">="
|
@@ -34,10 +23,10 @@ dependencies:
|
|
34
23
|
version: "0"
|
35
24
|
type: :runtime
|
36
25
|
prerelease: false
|
37
|
-
version_requirements: *
|
26
|
+
version_requirements: *id001
|
38
27
|
- !ruby/object:Gem::Dependency
|
39
28
|
name: childprocess
|
40
|
-
requirement: &
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
30
|
none: false
|
42
31
|
requirements:
|
43
32
|
- - ~>
|
@@ -45,21 +34,21 @@ dependencies:
|
|
45
34
|
version: "0.1"
|
46
35
|
type: :runtime
|
47
36
|
prerelease: false
|
48
|
-
version_requirements: *
|
37
|
+
version_requirements: *id002
|
49
38
|
- !ruby/object:Gem::Dependency
|
50
39
|
name: rake
|
51
|
-
requirement: &
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
41
|
none: false
|
53
42
|
requirements:
|
54
|
-
- - "
|
43
|
+
- - ">="
|
55
44
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0
|
45
|
+
version: "0"
|
57
46
|
type: :development
|
58
47
|
prerelease: false
|
59
|
-
version_requirements: *
|
48
|
+
version_requirements: *id003
|
60
49
|
- !ruby/object:Gem::Dependency
|
61
50
|
name: cucumber
|
62
|
-
requirement: &
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
63
52
|
none: false
|
64
53
|
requirements:
|
65
54
|
- - ">="
|
@@ -67,10 +56,10 @@ dependencies:
|
|
67
56
|
version: "0"
|
68
57
|
type: :development
|
69
58
|
prerelease: false
|
70
|
-
version_requirements: *
|
59
|
+
version_requirements: *id004
|
71
60
|
- !ruby/object:Gem::Dependency
|
72
61
|
name: gherkin
|
73
|
-
requirement: &
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
74
63
|
none: false
|
75
64
|
requirements:
|
76
65
|
- - "="
|
@@ -78,10 +67,10 @@ dependencies:
|
|
78
67
|
version: 2.3.9
|
79
68
|
type: :development
|
80
69
|
prerelease: false
|
81
|
-
version_requirements: *
|
70
|
+
version_requirements: *id005
|
82
71
|
- !ruby/object:Gem::Dependency
|
83
72
|
name: rspec
|
84
|
-
requirement: &
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
85
74
|
none: false
|
86
75
|
requirements:
|
87
76
|
- - ">="
|
@@ -89,10 +78,10 @@ dependencies:
|
|
89
78
|
version: "0"
|
90
79
|
type: :development
|
91
80
|
prerelease: false
|
92
|
-
version_requirements: *
|
81
|
+
version_requirements: *id006
|
93
82
|
- !ruby/object:Gem::Dependency
|
94
83
|
name: jeweler
|
95
|
-
requirement: &
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
96
85
|
none: false
|
97
86
|
requirements:
|
98
87
|
- - ~>
|
@@ -100,10 +89,10 @@ dependencies:
|
|
100
89
|
version: 1.5.2
|
101
90
|
type: :development
|
102
91
|
prerelease: false
|
103
|
-
version_requirements: *
|
92
|
+
version_requirements: *id007
|
104
93
|
- !ruby/object:Gem::Dependency
|
105
94
|
name: bundler
|
106
|
-
requirement: &
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
107
96
|
none: false
|
108
97
|
requirements:
|
109
98
|
- - ">="
|
@@ -111,10 +100,10 @@ dependencies:
|
|
111
100
|
version: "0"
|
112
101
|
type: :development
|
113
102
|
prerelease: false
|
114
|
-
version_requirements: *
|
103
|
+
version_requirements: *id008
|
115
104
|
- !ruby/object:Gem::Dependency
|
116
105
|
name: sinatra-reloader
|
117
|
-
requirement: &
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
118
107
|
none: false
|
119
108
|
requirements:
|
120
109
|
- - ">="
|
@@ -122,10 +111,10 @@ dependencies:
|
|
122
111
|
version: "0"
|
123
112
|
type: :development
|
124
113
|
prerelease: false
|
125
|
-
version_requirements: *
|
114
|
+
version_requirements: *id009
|
126
115
|
- !ruby/object:Gem::Dependency
|
127
116
|
name: mechanize
|
128
|
-
requirement: &
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
129
118
|
none: false
|
130
119
|
requirements:
|
131
120
|
- - ">="
|
@@ -133,10 +122,10 @@ dependencies:
|
|
133
122
|
version: 1.0.0
|
134
123
|
type: :development
|
135
124
|
prerelease: false
|
136
|
-
version_requirements: *
|
125
|
+
version_requirements: *id010
|
137
126
|
- !ruby/object:Gem::Dependency
|
138
127
|
name: gemcutter
|
139
|
-
requirement: &
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
140
129
|
none: false
|
141
130
|
requirements:
|
142
131
|
- - ">="
|
@@ -144,7 +133,7 @@ dependencies:
|
|
144
133
|
version: "0"
|
145
134
|
type: :development
|
146
135
|
prerelease: false
|
147
|
-
version_requirements: *
|
136
|
+
version_requirements: *id011
|
148
137
|
description: Mirage aids testing of your applications by hosting mock responses so that your applications do not have to talk to real endpoints. Its accessible via HTTP and has a RESTful interface.
|
149
138
|
email:
|
150
139
|
executables:
|
@@ -161,32 +150,33 @@ files:
|
|
161
150
|
- bin/mirage
|
162
151
|
- features/client/clear.feature
|
163
152
|
- features/client/mirage_client.feature
|
164
|
-
- features/client/
|
153
|
+
- features/client/put.feature
|
154
|
+
- features/client/request.feature
|
155
|
+
- features/client/response.feature
|
165
156
|
- features/client/save_and_revert.feature
|
166
|
-
- features/client/set.feature
|
167
|
-
- features/client/track.feature
|
168
|
-
- features/server/clear.feature
|
169
157
|
- features/server/command_line_iterface.feature
|
170
158
|
- features/server/logging.feature
|
171
|
-
- features/server/peek.feature
|
172
159
|
- features/server/prime.feature
|
173
|
-
- features/server/
|
160
|
+
- features/server/requests/delete.feature
|
161
|
+
- features/server/requests/get.feature
|
174
162
|
- features/server/save_and_revert.feature
|
175
|
-
- features/server/
|
176
|
-
- features/server/
|
177
|
-
- features/server/
|
178
|
-
- features/server/
|
179
|
-
- features/server/
|
163
|
+
- features/server/templates/delete.feature
|
164
|
+
- features/server/templates/get.feature
|
165
|
+
- features/server/templates/put/put.feature
|
166
|
+
- features/server/templates/put/put_as_default.feature
|
167
|
+
- features/server/templates/put/put_with_delay.feature
|
168
|
+
- features/server/templates/put/put_with_pattern.feature
|
169
|
+
- features/server/templates/put/put_with_substitutions.feature
|
180
170
|
- features/server/web_user_interface.feature
|
181
171
|
- features/step_definitions/my_steps.rb
|
182
172
|
- features/support/env.rb
|
183
173
|
- full_build.sh
|
184
|
-
- lib/mirage.rb
|
185
174
|
- lib/mirage/client.rb
|
186
175
|
- lib/mirage/core.rb
|
187
176
|
- lib/mirage/mock_response.rb
|
188
177
|
- lib/mirage/mock_responses_collection.rb
|
189
178
|
- lib/mirage/object.rb
|
179
|
+
- lib/mirage/server.rb
|
190
180
|
- lib/mirage/util.rb
|
191
181
|
- lib/mirage/web.rb
|
192
182
|
- lib/start_mirage.rb
|
@@ -213,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
213
203
|
requirements:
|
214
204
|
- - ">="
|
215
205
|
- !ruby/object:Gem::Version
|
216
|
-
hash:
|
206
|
+
hash: -4139461546343420148
|
217
207
|
segments:
|
218
208
|
- 0
|
219
209
|
version: "0"
|
@@ -226,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
216
|
requirements: []
|
227
217
|
|
228
218
|
rubyforge_project:
|
229
|
-
rubygems_version: 1.6.
|
219
|
+
rubygems_version: 1.6.2
|
230
220
|
signing_key:
|
231
221
|
specification_version: 3
|
232
222
|
summary: Mirage is a easy mock server for testing your applications
|
@@ -1,93 +0,0 @@
|
|
1
|
-
Feature: Responses and requests can be cleared.
|
2
|
-
Clearing a response clears any associated request information that may have been stored.
|
3
|
-
|
4
|
-
Usage:
|
5
|
-
${mirage_url}/clear - Clear all responses and requests
|
6
|
-
${mirage_url}/clear/requests - Clear all requests
|
7
|
-
${mirage_url}/clear/response_id - Clear a requests and response for a particular response
|
8
|
-
${mirage_url}/clear/request/response_id - Clear request for a particular response
|
9
|
-
|
10
|
-
|
11
|
-
Background: The MockServer has already got a response for greeting and leaving on it.
|
12
|
-
Given I send PUT to 'http://localhost:7001/mirage/templates/greeting' with body 'Hello'
|
13
|
-
And I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
14
|
-
|
15
|
-
And I send PUT to 'http://localhost:7001/mirage/templates/leaving' with body 'Goodbye'
|
16
|
-
And I send GET to 'http://localhost:7001/mirage/responses/leaving'
|
17
|
-
|
18
|
-
|
19
|
-
Scenario: Clearing all responses
|
20
|
-
Given I send DELETE to 'http://localhost:7001/mirage/templates'
|
21
|
-
|
22
|
-
When I send GET to 'http://localhost:7001/mirage/requests/1'
|
23
|
-
Then a 404 should be returned
|
24
|
-
When I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
25
|
-
Then a 404 should be returned
|
26
|
-
When I send GET to 'http://localhost:7001/mirage/templates/1'
|
27
|
-
Then a 404 should be returned
|
28
|
-
|
29
|
-
When I send GET to 'http://localhost:7001/mirage/requests/2'
|
30
|
-
Then a 404 should be returned
|
31
|
-
When I send GET to 'http://localhost:7001/mirage/responses/leaving'
|
32
|
-
Then a 404 should be returned
|
33
|
-
When I send GET to 'http://localhost:7001/mirage/templates/2'
|
34
|
-
Then a 404 should be returned
|
35
|
-
|
36
|
-
|
37
|
-
Scenario: Clearing a particular response
|
38
|
-
Given I send DELETE to 'http://localhost:7001/mirage/templates/1'
|
39
|
-
|
40
|
-
When I send GET to 'http://localhost:7001/mirage/templates/1'
|
41
|
-
Then a 404 should be returned
|
42
|
-
When I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
43
|
-
Then a 404 should be returned
|
44
|
-
When I send GET to 'http://localhost:7001/mirage/requests/1'
|
45
|
-
Then a 404 should be returned
|
46
|
-
|
47
|
-
When I send GET to 'http://localhost:7001/mirage/requests/2'
|
48
|
-
Then a 200 should be returned
|
49
|
-
When I send GET to 'http://localhost:7001/mirage/responses/leaving'
|
50
|
-
Then a 200 should be returned
|
51
|
-
When I send GET to 'http://localhost:7001/mirage/templates/2'
|
52
|
-
Then a 200 should be returned
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
Scenario: Clearing all requests
|
57
|
-
And I send DELETE to 'http://localhost:7001/mirage/requests'
|
58
|
-
|
59
|
-
When I send GET to 'http://localhost:7001/mirage/requests/1'
|
60
|
-
Then a 404 should be returned
|
61
|
-
When I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
62
|
-
Then a 200 should be returned
|
63
|
-
When I send GET to 'http://localhost:7001/mirage/templates/1'
|
64
|
-
Then a 200 should be returned
|
65
|
-
|
66
|
-
|
67
|
-
When I send GET to 'http://localhost:7001/mirage/requests/2'
|
68
|
-
Then a 404 should be returned
|
69
|
-
When I send GET to 'http://localhost:7001/mirage/responses/leaving'
|
70
|
-
Then a 200 should be returned
|
71
|
-
When I send GET to 'http://localhost:7001/mirage/templates/2'
|
72
|
-
Then a 200 should be returned
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
Scenario: Clearing a stored request for a prticular response
|
77
|
-
And I send DELETE to 'http://localhost:7001/mirage/requests/1'
|
78
|
-
|
79
|
-
When I send GET to 'http://localhost:7001/mirage/requests/1'
|
80
|
-
Then a 404 should be returned
|
81
|
-
When I send GET to 'http://localhost:7001/mirage/responses/greeting'
|
82
|
-
Then a 200 should be returned
|
83
|
-
When I send GET to 'http://localhost:7001/mirage/templates/1'
|
84
|
-
Then a 200 should be returned
|
85
|
-
|
86
|
-
|
87
|
-
When I send GET to 'http://localhost:7001/mirage/requests/2'
|
88
|
-
Then a 200 should be returned
|
89
|
-
When I send GET to 'http://localhost:7001/mirage/responses/leaving'
|
90
|
-
Then a 200 should be returned
|
91
|
-
When I send GET to 'http://localhost:7001/mirage/templates/2'
|
92
|
-
Then a 200 should be returned
|
93
|
-
|
@@ -1,71 +0,0 @@
|
|
1
|
-
Feature: After a response has been served from Mirage, the content of the request that triggered it can be retrieved. This is useful
|
2
|
-
for testing that the correct information was sent to the endpoint.
|
3
|
-
|
4
|
-
On setting a response, a unique id is returned which can be used to look up the last request made to get that response.
|
5
|
-
|
6
|
-
If the the response is reset then the same id is returned in order to make it easier to keep track of.
|
7
|
-
|
8
|
-
Responses hosted on the same endpoint but with a pattern are considered unique and so get their own ID.
|
9
|
-
|
10
|
-
If the request body contains content this is stored. Otherwise it is the query string that is stored.
|
11
|
-
|
12
|
-
If a response is 'peeked' this does not count as a request that should be stored.
|
13
|
-
|
14
|
-
Background: There is a response already on Mirage
|
15
|
-
Given I send PUT to 'http://localhost:7001/mirage/templates/greeting' with body 'Hello' and headers:
|
16
|
-
| X-mirage-method | POST |
|
17
|
-
|
18
|
-
|
19
|
-
Scenario: Tracking a response that was triggered by a request that had content in the body
|
20
|
-
Given I send POST to 'http://localhost:7001/mirage/responses/greeting' with request entity
|
21
|
-
"""
|
22
|
-
Hello Mirage
|
23
|
-
"""
|
24
|
-
When I send GET to 'http://localhost:7001/mirage/requests/1'
|
25
|
-
Then 'Hello Mirage' should be returned
|
26
|
-
|
27
|
-
|
28
|
-
Scenario: Tracking a response that was triggered by a request with a query string
|
29
|
-
Given I send POST to 'http://localhost:7001/mirage/responses/greeting' with parameters:
|
30
|
-
| surname | Davis |
|
31
|
-
| firstname | Leon |
|
32
|
-
When I send GET to 'http://localhost:7001/mirage/requests/1'
|
33
|
-
Then 'surname=Davis&firstname=Leon' should be returned
|
34
|
-
|
35
|
-
|
36
|
-
Scenario: Tracking a response that has not been served yet
|
37
|
-
Given I send GET to 'http://localhost:7001/mirage/requests/1'
|
38
|
-
Then a 404 should be returned
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
Scenario: A response is peeked at
|
43
|
-
Given I send POST to 'http://localhost:7001/mirage/responses/greeting' with request entity
|
44
|
-
"""
|
45
|
-
Hello
|
46
|
-
"""
|
47
|
-
And I send GET to 'http://localhost:7001/mirage/templates/1'
|
48
|
-
When I send GET to 'http://localhost:7001/mirage/requests/1'
|
49
|
-
Then 'Hello' should be returned
|
50
|
-
|
51
|
-
|
52
|
-
Scenario: A default response and one for the same endpoint with a pattern are set
|
53
|
-
Given I send PUT to 'http://localhost:7001/mirage/templates/greeting' with body 'Hello who ever you are'
|
54
|
-
Then '2' should be returned
|
55
|
-
|
56
|
-
Given I send PUT to 'http://localhost:7001/mirage/templates/greeting' with body 'Hello' and headers:
|
57
|
-
| X-mirage-pattern | Leon |
|
58
|
-
Then '3' should be returned
|
59
|
-
|
60
|
-
When I send GET to 'http://localhost:7001/mirage/responses/greeting' with parameters:
|
61
|
-
| name | Joel |
|
62
|
-
And I send GET to 'http://localhost:7001/mirage/responses/greeting' with parameters:
|
63
|
-
| name | Leon |
|
64
|
-
|
65
|
-
And I send GET to 'http://localhost:7001/mirage/requests/2'
|
66
|
-
Then 'name=Joel' should be returned
|
67
|
-
|
68
|
-
And I send GET to 'http://localhost:7001/mirage/requests/3'
|
69
|
-
Then 'name=Leon' should be returned
|
70
|
-
|
71
|
-
|
data/lib/mirage.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'mirage/object'
|
2
|
-
require 'mirage/web'
|
3
|
-
require 'mirage/util'
|
4
|
-
require 'mirage/mock_response'
|
5
|
-
require 'mirage/mock_responses_collection'
|
6
|
-
require 'mirage/core'
|
7
|
-
require 'mirage/client'
|
8
|
-
|
9
|
-
module Mirage
|
10
|
-
# When mirage starts it loads any ruby files found in the responses directory. Use this method to get hold of a client configured for the running server.
|
11
|
-
def self.prime
|
12
|
-
yield @@client
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.client= client
|
16
|
-
@@client = client
|
17
|
-
end
|
18
|
-
end
|