mirage 0.1.7 → 1.0.0

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.
@@ -22,7 +22,7 @@ Feature: the Mirage client provides a method for getting responses
22
22
  """
23
23
  Mirage::Client.new.get('greeting', :firstname => 'leon', :surname => 'davis').should == 'hello'
24
24
  """
25
- And I hit 'http://localhost:7001/mirage/check_request/1'
25
+ And I hit 'http://localhost:7001/mirage/track/1'
26
26
  Then 'firstname=leon&surname=davis' should be returned
27
27
 
28
28
  Scenario: getting a response with a request body
@@ -30,7 +30,7 @@ Feature: the Mirage client provides a method for getting responses
30
30
  """
31
31
  Mirage::Client.new.get('greeting','<greetingRequest></greetingRequest>').should == 'hello'
32
32
  """
33
- And I hit 'http://localhost:7001/mirage/check_request/1'
33
+ And I hit 'http://localhost:7001/mirage/track/1'
34
34
  Then '<greetingRequest></greetingRequest>' should be returned
35
35
 
36
36
  Scenario: getting a response that does not exist
File without changes
@@ -16,5 +16,5 @@ Feature: Requests made to the Mirage Server can be tracked using the Mirage clie
16
16
  | name | leon |
17
17
  Then I run
18
18
  """
19
- Mirage::Client.new.check_request(1).should == 'name=leon'
19
+ Mirage::Client.new.track(1).should == 'name=leon'
20
20
  """
File without changes
File without changes
File without changes
@@ -4,7 +4,7 @@ Feature: Its possible introduce a delay before responding to a client with a par
4
4
  Scenario: Response with a delay
5
5
  Given I hit 'http://localhost:7001/mirage/set/an_appology' with parameters:
6
6
  | response | Sorry it took me so long! |
7
- | delay | 4 |
7
+ | delay | 4.2 |
8
8
 
9
9
  When I hit 'http://localhost:7001/mirage/get/an_appology'
10
- Then it should take at least '4' seconds
10
+ Then it should take at least '4.2' seconds
@@ -21,7 +21,7 @@ Feature: After a response has been served from Mirage, the content of the reques
21
21
  """
22
22
  Hello MockServer
23
23
  """
24
- When I hit 'http://localhost:7001/mirage/check_request/1'
24
+ When I hit 'http://localhost:7001/mirage/track/1'
25
25
  Then 'Hello MockServer' should be returned
26
26
 
27
27
 
@@ -29,12 +29,12 @@ Feature: After a response has been served from Mirage, the content of the reques
29
29
  Given I hit 'http://localhost:7001/mirage/get/greeting' with parameters:
30
30
  | surname | Davis |
31
31
  | firstname | Leon |
32
- When I hit 'http://localhost:7001/mirage/check_request/1'
32
+ When I hit 'http://localhost:7001/mirage/track/1'
33
33
  Then 'surname=Davis&firstname=Leon' should be returned
34
34
 
35
35
 
36
36
  Scenario: Querying a response that has not been served yet
37
- Given I hit 'http://localhost:7001/mirage/check_request/1'
37
+ Given I hit 'http://localhost:7001/mirage/track/1'
38
38
  Then a 404 should be returned
39
39
 
40
40
 
@@ -44,7 +44,7 @@ Feature: After a response has been served from Mirage, the content of the reques
44
44
  Hello
45
45
  """
46
46
  And I hit 'http://localhost:7001/mirage/peek/1'
47
- When I hit 'http://localhost:7001/mirage/check_request/1'
47
+ When I hit 'http://localhost:7001/mirage/track/1'
48
48
  Then 'Hello' should be returned
49
49
 
50
50
 
@@ -66,9 +66,9 @@ Feature: After a response has been served from Mirage, the content of the reques
66
66
  """
67
67
  My name is Leon
68
68
  """
69
- And I hit 'http://localhost:7001/mirage/check_request/1'
69
+ And I hit 'http://localhost:7001/mirage/track/1'
70
70
  Then 'My name is Joel' should be returned
71
- And I hit 'http://localhost:7001/mirage/check_request/3'
71
+ And I hit 'http://localhost:7001/mirage/track/3'
72
72
  Then 'My name is Leon' should be returned
73
73
 
74
74
 
data/lib/mirage.rb CHANGED
@@ -4,6 +4,7 @@ require 'mirage/core'
4
4
  require 'mirage/client'
5
5
 
6
6
  module Mirage
7
+ # 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.
7
8
  def self.prime
8
9
  yield @@client
9
10
  end
data/lib/mirage/client.rb CHANGED
@@ -95,9 +95,9 @@ module Mirage
95
95
  # request did not have any content in its body then what ever was in the request query string is returned instead
96
96
  #
97
97
  # Example:
98
- # Client.new.check_request(response_id) => Tracked request as a String
99
- def check_request response_id
100
- response(http_get("#{@url}/check_request/#{response_id}"))
98
+ # Client.new.track(response_id) => Tracked request as a String
99
+ def track response_id
100
+ response(http_get("#{@url}/track/#{response_id}"))
101
101
  end
102
102
 
103
103
  # Save the state of the Mirage server so that it can be reverted back to that exact state at a later time.
data/lib/mirage/core.rb CHANGED
@@ -147,7 +147,7 @@ module Mirage
147
147
  end
148
148
  end
149
149
 
150
- def check_request id
150
+ def track id
151
151
  REQUESTS[id.to_i] || respond("Nothing stored for: #{id}", 404)
152
152
  end
153
153
 
@@ -15,7 +15,7 @@
15
15
  <?r unless @responses.empty? ?>
16
16
  <table border="1" width='100%'>
17
17
  <?r @responses.each do |key, response| ?>
18
- <tr><td><a id='peek_response_#{response.response_id}' href="/mirage/peek/#{response.response_id}">#{key}</a></td><td><a id='check_response_#{response.response_id}' href="/mirage/check_request/#{response.response_id}">check</a></td></tr>
18
+ <tr><td><a id='peek_response_#{response.response_id}' href="/mirage/peek/#{response.response_id}">#{key}</a></td><td><a id='check_response_#{response.response_id}' href="/mirage/track/#{response.response_id}">check</a></td></tr>
19
19
  <?r end ?>
20
20
  </table>
21
21
  <?r end ?>
data/mirage.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'mirage'
3
- s.version = '0.1.7'
3
+ s.version = '1.0.0'
4
4
  s.authors = ["Leon Davis"]
5
5
  s.homepage = 'https://github.com/lashd/mirage'
6
6
  s.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.'
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mirage
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease:
5
- version: 0.1.7
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
6
11
  platform: ruby
7
12
  authors:
8
13
  - Leon Davis
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-03-28 00:00:00 +01:00
18
+ date: 2011-03-29 00:00:00 +01:00
14
19
  default_executable: mirage
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
@@ -21,6 +26,11 @@ dependencies:
21
26
  requirements:
22
27
  - - ~>
23
28
  - !ruby/object:Gem::Version
29
+ hash: 19
30
+ segments:
31
+ - 1
32
+ - 1
33
+ - 0
24
34
  version: 1.1.0
25
35
  type: :runtime
26
36
  version_requirements: *id001
@@ -32,6 +42,11 @@ dependencies:
32
42
  requirements:
33
43
  - - ">="
34
44
  - !ruby/object:Gem::Version
45
+ hash: 16127
46
+ segments:
47
+ - 2011
48
+ - 1
49
+ - 30
35
50
  version: 2011.01.30
36
51
  type: :runtime
37
52
  version_requirements: *id002
@@ -43,6 +58,11 @@ dependencies:
43
58
  requirements:
44
59
  - - ">="
45
60
  - !ruby/object:Gem::Version
61
+ hash: 23
62
+ segments:
63
+ - 1
64
+ - 0
65
+ - 0
46
66
  version: 1.0.0
47
67
  type: :runtime
48
68
  version_requirements: *id003
@@ -54,6 +74,9 @@ dependencies:
54
74
  requirements:
55
75
  - - ">="
56
76
  - !ruby/object:Gem::Version
77
+ hash: 3
78
+ segments:
79
+ - 0
57
80
  version: "0"
58
81
  type: :development
59
82
  version_requirements: *id004
@@ -65,6 +88,9 @@ dependencies:
65
88
  requirements:
66
89
  - - ">="
67
90
  - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
68
94
  version: "0"
69
95
  type: :development
70
96
  version_requirements: *id005
@@ -76,6 +102,9 @@ dependencies:
76
102
  requirements:
77
103
  - - ">="
78
104
  - !ruby/object:Gem::Version
105
+ hash: 3
106
+ segments:
107
+ - 0
79
108
  version: "0"
80
109
  type: :development
81
110
  version_requirements: *id006
@@ -87,6 +116,9 @@ dependencies:
87
116
  requirements:
88
117
  - - ">="
89
118
  - !ruby/object:Gem::Version
119
+ hash: 3
120
+ segments:
121
+ - 0
90
122
  version: "0"
91
123
  type: :development
92
124
  version_requirements: *id007
@@ -103,29 +135,29 @@ files:
103
135
  - Gemfile
104
136
  - README.md
105
137
  - bin/mirage
106
- - features/checking_for_requests.feature
107
- - features/clearing_requests_and_responses.feature
108
- - features/client/checking_for_requests.feature
109
- - features/client/clearing_responses.feature
110
- - features/client/getting_responses.feature
138
+ - features/clear.feature
139
+ - features/client/clear.feature
140
+ - features/client/get.feature
111
141
  - features/client/mirage_client.feature
112
- - features/client/peeking.feature
113
- - features/client/setting_responses.feature
114
- - features/client/snapshotting.feature
142
+ - features/client/peek.feature
143
+ - features/client/save_and_revert.feature
144
+ - features/client/set.feature
145
+ - features/client/track.feature
115
146
  - features/command_line_iterface.feature
116
- - features/default_responses.feature
117
147
  - features/file_hosting.feature
118
148
  - features/logging.feature
119
- - features/peeking_at_response.feature
120
- - features/priming.feature
149
+ - features/peek.feature
150
+ - features/prime.feature
121
151
  - features/resources/test.zip
122
152
  - features/response_templates.feature
123
- - features/save.feature
124
- - features/setting_responses.feature
125
- - features/setting_responses_with_a_delay.feature
126
- - features/setting_responses_with_pattern_matching.feature
153
+ - features/save_and_revert.feature
154
+ - features/set.feature
155
+ - features/set_default_response.feature
156
+ - features/set_with_a_delay.feature
157
+ - features/set_with_a_pattern.feature
127
158
  - features/step_definitions/my_steps.rb
128
159
  - features/support/env.rb
160
+ - features/track.feature
129
161
  - features/web_user_interface.feature
130
162
  - full_build.sh
131
163
  - lib/config.ru
@@ -142,13 +174,18 @@ has_rdoc: true
142
174
  homepage: https://github.com/lashd/mirage
143
175
  licenses: []
144
176
 
145
- post_install_message: "\n\
146
- ===============================================================================\n\
147
- Thanks you for installing mirage-0.1.7. \n\n\
148
- Run Mirage with:\n\n\
149
- mirage start \n\n\
150
- For more information go to: https://github.com/lashd/mirage/wiki\n\
151
- ===============================================================================\n"
177
+ post_install_message: |
178
+
179
+ ===============================================================================
180
+ Thanks you for installing mirage-1.0.0.
181
+
182
+ Run Mirage with:
183
+
184
+ mirage start
185
+
186
+ For more information go to: https://github.com/lashd/mirage/wiki
187
+ ===============================================================================
188
+
152
189
  rdoc_options: []
153
190
 
154
191
  require_paths:
@@ -158,12 +195,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
195
  requirements:
159
196
  - - ">="
160
197
  - !ruby/object:Gem::Version
198
+ hash: 3
199
+ segments:
200
+ - 0
161
201
  version: "0"
162
202
  required_rubygems_version: !ruby/object:Gem::Requirement
163
203
  none: false
164
204
  requirements:
165
205
  - - ">="
166
206
  - !ruby/object:Gem::Version
207
+ hash: 3
208
+ segments:
209
+ - 0
167
210
  version: "0"
168
211
  requirements: []
169
212
 
@@ -171,29 +214,29 @@ rubyforge_project:
171
214
  rubygems_version: 1.6.1
172
215
  signing_key:
173
216
  specification_version: 3
174
- summary: mirage-0.1.7
217
+ summary: mirage-1.0.0
175
218
  test_files:
176
- - features/checking_for_requests.feature
177
- - features/clearing_requests_and_responses.feature
178
- - features/client/checking_for_requests.feature
179
- - features/client/clearing_responses.feature
180
- - features/client/getting_responses.feature
219
+ - features/clear.feature
220
+ - features/client/clear.feature
221
+ - features/client/get.feature
181
222
  - features/client/mirage_client.feature
182
- - features/client/peeking.feature
183
- - features/client/setting_responses.feature
184
- - features/client/snapshotting.feature
223
+ - features/client/peek.feature
224
+ - features/client/save_and_revert.feature
225
+ - features/client/set.feature
226
+ - features/client/track.feature
185
227
  - features/command_line_iterface.feature
186
- - features/default_responses.feature
187
228
  - features/file_hosting.feature
188
229
  - features/logging.feature
189
- - features/peeking_at_response.feature
190
- - features/priming.feature
230
+ - features/peek.feature
231
+ - features/prime.feature
191
232
  - features/resources/test.zip
192
233
  - features/response_templates.feature
193
- - features/save.feature
194
- - features/setting_responses.feature
195
- - features/setting_responses_with_a_delay.feature
196
- - features/setting_responses_with_pattern_matching.feature
234
+ - features/save_and_revert.feature
235
+ - features/set.feature
236
+ - features/set_default_response.feature
237
+ - features/set_with_a_delay.feature
238
+ - features/set_with_a_pattern.feature
197
239
  - features/step_definitions/my_steps.rb
198
240
  - features/support/env.rb
241
+ - features/track.feature
199
242
  - features/web_user_interface.feature