anmo 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +1 -7
- data/lib/anmo/application.rb +28 -17
- data/lib/anmo/version.rb +1 -1
- data/test/anmo/application_test.rb +7 -0
- metadata +162 -164
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -25,10 +25,4 @@ Anmo.create_request({
|
|
25
25
|
```
|
26
26
|
curl http://localhost:8787/lookatmyhorse
|
27
27
|
my horse is amazing
|
28
|
-
```
|
29
|
-
|
30
|
-
Multiple Hosts?
|
31
|
-
---------------
|
32
|
-
|
33
|
-
Yep. If you have one running anmo server then each domain that points to that server will have it's own data in anmo.
|
34
|
-
For example the hosts anmo2.example.org and anmo2.example.org can point at the same anmo instance, and each will have their own data.
|
28
|
+
```
|
data/lib/anmo/application.rb
CHANGED
@@ -82,28 +82,39 @@ module Anmo
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def find_stored_request actual_request
|
85
|
-
|
86
|
-
|
87
|
-
|
85
|
+
actual_request_query = Rack::Utils.parse_query(actual_request.query_string)
|
86
|
+
|
87
|
+
suspected_request = ApplicationDataStore.stored_objects.find do |r|
|
88
|
+
r["path"].gsub(/\?.*/, "") == actual_request.path_info
|
88
89
|
end
|
89
90
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
91
|
+
if suspected_request
|
92
|
+
return unless request_has_same_method actual_request, suspected_request
|
93
|
+
return unless request_has_same_query actual_request, suspected_request
|
94
|
+
return unless request_has_required_headers actual_request, suspected_request
|
95
|
+
end
|
96
|
+
suspected_request
|
97
|
+
end
|
98
|
+
|
99
|
+
def request_has_same_method initial_request, suspected_request
|
100
|
+
return true if suspected_request["method"] == nil
|
101
|
+
suspected_request["method"].upcase == initial_request.request_method
|
102
|
+
end
|
103
|
+
|
104
|
+
def request_has_same_query initial_request, suspected_request
|
105
|
+
return true if suspected_request["path"].include?("?") == false
|
106
|
+
query = Rack::Utils.parse_query(suspected_request["path"].gsub(/.*\?/, ""))
|
107
|
+
query == Rack::Utils.parse_query(initial_request.query_string)
|
108
|
+
end
|
97
109
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
end
|
110
|
+
def request_has_required_headers initial_request, suspected_request
|
111
|
+
required_headers = suspected_request["required_headers"] || []
|
112
|
+
required_headers.each do |name, value|
|
113
|
+
if initial_request.env[convert_header_name_to_rack_style_name(name)] != value
|
114
|
+
return false
|
104
115
|
end
|
105
116
|
end
|
106
|
-
|
117
|
+
true
|
107
118
|
end
|
108
119
|
|
109
120
|
def convert_header_name_to_rack_style_name name
|
data/lib/anmo/version.rb
CHANGED
@@ -59,6 +59,13 @@ module Anmo
|
|
59
59
|
assert_equal "please save this", last_response.body
|
60
60
|
end
|
61
61
|
|
62
|
+
def test_returns_object_if_request_has_query_parameters_in_different_order
|
63
|
+
save_object "/?aaa=aaa&bbb=bbb", "please save this", nil, nil, nil
|
64
|
+
get "/?bbb=bbb&aaa=aaa"
|
65
|
+
assert_equal 200, last_response.status
|
66
|
+
assert_equal "please save this", last_response.body
|
67
|
+
end
|
68
|
+
|
62
69
|
def test_stores_status_code
|
63
70
|
save_object "/monkeys", nil, 123, nil, nil
|
64
71
|
get "/monkeys"
|
metadata
CHANGED
@@ -1,183 +1,172 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: anmo
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 59
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 18
|
10
|
+
version: 0.0.18
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Andrew Vos
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-05-14 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: rack
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
38
32
|
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: thin
|
39
36
|
prerelease: false
|
40
|
-
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
54
46
|
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: httparty
|
55
50
|
prerelease: false
|
56
|
-
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
type: :runtime
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
63
|
name: rake
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
type: :development
|
71
64
|
prerelease: false
|
72
|
-
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
86
74
|
type: :development
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: minitest
|
87
78
|
prerelease: false
|
88
|
-
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- -
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ! '>='
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0'
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
102
88
|
type: :development
|
89
|
+
version_requirements: *id005
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: rack-test
|
103
92
|
prerelease: false
|
104
|
-
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
93
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
118
102
|
type: :development
|
103
|
+
version_requirements: *id006
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: cucumber
|
119
106
|
prerelease: false
|
120
|
-
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- -
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
none: false
|
130
|
-
requirements:
|
131
|
-
- - ! '>='
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
107
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
134
116
|
type: :development
|
117
|
+
version_requirements: *id007
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: rspec
|
135
120
|
prerelease: false
|
136
|
-
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- -
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
121
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
hash: 3
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
version: "0"
|
150
130
|
type: :development
|
131
|
+
version_requirements: *id008
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: guard
|
151
134
|
prerelease: false
|
152
|
-
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- -
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ! '>='
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
135
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
136
|
+
none: false
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
hash: 3
|
141
|
+
segments:
|
142
|
+
- 0
|
143
|
+
version: "0"
|
166
144
|
type: :development
|
145
|
+
version_requirements: *id009
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: guard-shell
|
167
148
|
prerelease: false
|
168
|
-
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- -
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
|
174
|
-
|
175
|
-
|
149
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
hash: 3
|
155
|
+
segments:
|
156
|
+
- 0
|
157
|
+
version: "0"
|
158
|
+
type: :development
|
159
|
+
version_requirements: *id010
|
160
|
+
description: ""
|
161
|
+
email:
|
176
162
|
- andrew.vos@gmail.com
|
177
163
|
executables: []
|
164
|
+
|
178
165
|
extensions: []
|
166
|
+
|
179
167
|
extra_rdoc_files: []
|
180
|
-
|
168
|
+
|
169
|
+
files:
|
181
170
|
- .gitignore
|
182
171
|
- .rvmrc
|
183
172
|
- .travis.yml
|
@@ -193,31 +182,40 @@ files:
|
|
193
182
|
- lib/anmo/application.rb
|
194
183
|
- lib/anmo/version.rb
|
195
184
|
- test/anmo/application_test.rb
|
196
|
-
homepage:
|
185
|
+
homepage: ""
|
197
186
|
licenses: []
|
187
|
+
|
198
188
|
post_install_message:
|
199
189
|
rdoc_options: []
|
200
|
-
|
190
|
+
|
191
|
+
require_paths:
|
201
192
|
- lib
|
202
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
193
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
203
194
|
none: false
|
204
|
-
requirements:
|
205
|
-
- -
|
206
|
-
- !ruby/object:Gem::Version
|
207
|
-
|
208
|
-
|
195
|
+
requirements:
|
196
|
+
- - ">="
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
hash: 3
|
199
|
+
segments:
|
200
|
+
- 0
|
201
|
+
version: "0"
|
202
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
203
|
none: false
|
210
|
-
requirements:
|
211
|
-
- -
|
212
|
-
- !ruby/object:Gem::Version
|
213
|
-
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
hash: 3
|
208
|
+
segments:
|
209
|
+
- 0
|
210
|
+
version: "0"
|
214
211
|
requirements: []
|
212
|
+
|
215
213
|
rubyforge_project: anmo
|
216
|
-
rubygems_version: 1.8.
|
214
|
+
rubygems_version: 1.8.17
|
217
215
|
signing_key:
|
218
216
|
specification_version: 3
|
219
|
-
summary:
|
220
|
-
test_files:
|
217
|
+
summary: ""
|
218
|
+
test_files:
|
221
219
|
- features/api.feature
|
222
220
|
- features/step_definitions/api_steps.rb
|
223
221
|
- features/support/env.rb
|