agile-proxy 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/.bowerrc +3 -0
  3. data/.gitignore +8 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +36 -0
  6. data/.travis.yml +8 -0
  7. data/Gemfile +4 -0
  8. data/Gemfile.lock +267 -0
  9. data/Guardfile +20 -0
  10. data/LICENSE +22 -0
  11. data/README.md +93 -0
  12. data/Rakefile +13 -0
  13. data/agile-proxy.gemspec +50 -0
  14. data/assets/index.html +39 -0
  15. data/assets/ui/app/HttpFlexibleProxyApi.js +31 -0
  16. data/assets/ui/app/app.js +1 -0
  17. data/assets/ui/app/controller/Stubs.js +64 -0
  18. data/assets/ui/app/controller/main.js +12 -0
  19. data/assets/ui/app/directive/AppEnhancedFormElement.js +21 -0
  20. data/assets/ui/app/directive/AppFor.js +16 -0
  21. data/assets/ui/app/directive/AppResponseEditor.js +54 -0
  22. data/assets/ui/app/model/RequestSpec.js +6 -0
  23. data/assets/ui/app/routes.js +10 -0
  24. data/assets/ui/app/service/Dialog.js +49 -0
  25. data/assets/ui/app/service/DomId.js +10 -0
  26. data/assets/ui/app/service/Error.js +7 -0
  27. data/assets/ui/app/service/Stub.js +36 -0
  28. data/assets/ui/app/view/404.html +2 -0
  29. data/assets/ui/app/view/dialog/error.html +10 -0
  30. data/assets/ui/app/view/dialog/yesNo.html +8 -0
  31. data/assets/ui/app/view/responses/editForm.html +78 -0
  32. data/assets/ui/app/view/status.html +1 -0
  33. data/assets/ui/app/view/stubs.html +19 -0
  34. data/assets/ui/app/view/stubs/edit.html +58 -0
  35. data/assets/ui/css/main.css +3 -0
  36. data/bin/agile_proxy +113 -0
  37. data/bower.json +27 -0
  38. data/config.yml +6 -0
  39. data/db.yml +10 -0
  40. data/db/migrations/20140818110800_create_users.rb +9 -0
  41. data/db/migrations/20140818134700_create_applications.rb +10 -0
  42. data/db/migrations/20140818135200_create_request_specs.rb +13 -0
  43. data/db/migrations/20140821115300_create_responses.rb +14 -0
  44. data/db/migrations/20140823082900_add_method_to_request_specs.rb +7 -0
  45. data/db/migrations/20140823083900_rename_request_spec_columns.rb +8 -0
  46. data/db/migrations/20141031072100_add_url_type_to_request_specs.rb +8 -0
  47. data/db/migrations/20141105125600_add_conditions_to_request_specs.rb +7 -0
  48. data/db/migrations/20141106083100_add_username_and_password_to_applications.rb +8 -0
  49. data/db/migrations/20141119143800_add_record_to_applications.rb +7 -0
  50. data/db/migrations/20141119174300_create_recordings.rb +18 -0
  51. data/db/schema.rb +78 -0
  52. data/examples/README.md +1 -0
  53. data/examples/facebook_api.html +59 -0
  54. data/examples/tumblr_api.html +22 -0
  55. data/lib/agile_proxy.rb +8 -0
  56. data/lib/agile_proxy/api/applications.rb +77 -0
  57. data/lib/agile_proxy/api/recordings.rb +52 -0
  58. data/lib/agile_proxy/api/request_specs.rb +85 -0
  59. data/lib/agile_proxy/api/root.rb +41 -0
  60. data/lib/agile_proxy/config.rb +63 -0
  61. data/lib/agile_proxy/handlers/handler.rb +43 -0
  62. data/lib/agile_proxy/handlers/proxy_handler.rb +110 -0
  63. data/lib/agile_proxy/handlers/request_handler.rb +57 -0
  64. data/lib/agile_proxy/handlers/stub_handler.rb +113 -0
  65. data/lib/agile_proxy/mitm.crt +22 -0
  66. data/lib/agile_proxy/mitm.key +27 -0
  67. data/lib/agile_proxy/model/application.rb +20 -0
  68. data/lib/agile_proxy/model/recording.rb +16 -0
  69. data/lib/agile_proxy/model/request_spec.rb +47 -0
  70. data/lib/agile_proxy/model/response.rb +56 -0
  71. data/lib/agile_proxy/model/user.rb +17 -0
  72. data/lib/agile_proxy/proxy_connection.rb +113 -0
  73. data/lib/agile_proxy/route.rb +106 -0
  74. data/lib/agile_proxy/router.rb +99 -0
  75. data/lib/agile_proxy/server.rb +85 -0
  76. data/lib/agile_proxy/servers/api.rb +41 -0
  77. data/lib/agile_proxy/servers/request_spec.rb +30 -0
  78. data/lib/agile_proxy/version.rb +6 -0
  79. data/load_proxy.js +39 -0
  80. data/log/.gitkeep +0 -0
  81. data/spec/common_helper.rb +32 -0
  82. data/spec/fixtures/test-server.crt +15 -0
  83. data/spec/fixtures/test-server.key +15 -0
  84. data/spec/integration/helpers/request_spec_helper.rb +60 -0
  85. data/spec/integration/specs/lib/server_spec.rb +407 -0
  86. data/spec/integration_spec_helper.rb +18 -0
  87. data/spec/spec_helper.rb +39 -0
  88. data/spec/support/test_server.rb +75 -0
  89. data/spec/unit/agile_proxy/api/applications_spec.rb +102 -0
  90. data/spec/unit/agile_proxy/api/common_helper.rb +31 -0
  91. data/spec/unit/agile_proxy/api/recordings_spec.rb +115 -0
  92. data/spec/unit/agile_proxy/api/request_specs_spec.rb +159 -0
  93. data/spec/unit/agile_proxy/handlers/handler_spec.rb +8 -0
  94. data/spec/unit/agile_proxy/handlers/proxy_handler_spec.rb +138 -0
  95. data/spec/unit/agile_proxy/handlers/request_handler_spec.rb +55 -0
  96. data/spec/unit/agile_proxy/handlers/stub_handler_spec.rb +154 -0
  97. data/spec/unit/agile_proxy/model/recording_spec.rb +0 -0
  98. data/spec/unit/agile_proxy/model/request_spec_spec.rb +45 -0
  99. data/spec/unit/agile_proxy/model/response_spec.rb +38 -0
  100. data/spec/unit/agile_proxy/server_spec.rb +88 -0
  101. data/spec/unit/agile_proxy/servers/api_spec.rb +31 -0
  102. data/spec/unit/agile_proxy/servers/request_spec_spec.rb +32 -0
  103. metadata +618 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dc1bf65c479bcd94691fbed198e7649f46b7fc83
4
+ data.tar.gz: 1fc3bb9b8f56a7799fa4888a007513af1c0c41a2
5
+ SHA512:
6
+ metadata.gz: c07d0049e4938f53fc3bd4681071ad3d2c4b9b4bf889c3edcdfe2e2cb3961059e60755905f7b3836016b8f6b258deb496139be9505596724c4e9220a330c65ab
7
+ data.tar.gz: 9f980bac9f53e0d99c52a9e3a8a5d24ce50035fcc2aa9cb3538281f99f3f13ef023e8a9139bca0005b0b4c8b3f9a3086e52138397c3b1b07b8b77bb3104c1b2b
data/.bowerrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "directory" : "assets/ui/bower_components"
3
+ }
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ node_modules/
2
+ log/test.log
3
+ .idea/
4
+ .ruby-version
5
+ assets/ui/bower_components
6
+ .yardoc
7
+ db/*.db
8
+ coverage/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.rubocop.yml ADDED
@@ -0,0 +1,36 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'db/**/*'
4
+ - 'assets/**/*'
5
+ - !ruby/regexp /old_and_unused\.rb$/
6
+ Style/Documentation:
7
+ Exclude:
8
+ - 'spec/**/*'
9
+ - 'bin/**/*'
10
+ Metrics/AbcSize:
11
+ Max: 36
12
+ Exclude:
13
+ - 'spec/**/*'
14
+ Metrics/CyclomaticComplexity:
15
+ Max: 5
16
+ Enabled: false
17
+ Metrics/LineLength:
18
+ Max: 125
19
+ Exclude:
20
+ - 'spec/**/*'
21
+ - 'agile-proxy.gemspec'
22
+ - 'Guardfile'
23
+ Metrics/MethodLength:
24
+ Max: 30
25
+ Exclude:
26
+ - 'spec/**/*'
27
+ Metrics/PerceivedComplexity:
28
+ Max: 7
29
+ Exclude:
30
+ - 'spec/**/*'
31
+ Style/TrivialAccessors:
32
+ Enabled: false
33
+ Style/SpecialGlobalVars:
34
+ Enabled: false
35
+ Style/RegexpLiteral:
36
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
6
+ script:
7
+ - bundle exec rake db:migrate ENV=test
8
+ - bundle exec rspec spec/unit
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in agile-proxy.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,267 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ agile-proxy (0.0.2)
5
+ activerecord (~> 4.1.6)
6
+ em-http-request (~> 1.1.2)
7
+ em-synchrony (~> 1.0.3)
8
+ eventmachine (~> 1.0.3)
9
+ eventmachine_httpserver (~> 0.2.1)
10
+ flavour_saver
11
+ grape (~> 0.9.0)
12
+ grape-kaminari (~> 0.1.6)
13
+ http_parser.rb (~> 0.6.0)
14
+ multi_json
15
+ rack-parser (~> 0.6.1)
16
+ shoulda-matchers
17
+ sqlite3 (~> 1.3.10)
18
+ thin (~> 1.6.2)
19
+ thor
20
+
21
+ GEM
22
+ remote: https://rubygems.org/
23
+ specs:
24
+ actionpack (4.1.6)
25
+ actionview (= 4.1.6)
26
+ activesupport (= 4.1.6)
27
+ rack (~> 1.5.2)
28
+ rack-test (~> 0.6.2)
29
+ actionview (4.1.6)
30
+ activesupport (= 4.1.6)
31
+ builder (~> 3.1)
32
+ erubis (~> 2.7.0)
33
+ activemodel (4.1.6)
34
+ activesupport (= 4.1.6)
35
+ builder (~> 3.1)
36
+ activerecord (4.1.6)
37
+ activemodel (= 4.1.6)
38
+ activesupport (= 4.1.6)
39
+ arel (~> 5.0.0)
40
+ activesupport (4.1.6)
41
+ i18n (~> 0.6, >= 0.6.9)
42
+ json (~> 1.7, >= 1.7.7)
43
+ minitest (~> 5.1)
44
+ thread_safe (~> 0.1)
45
+ tzinfo (~> 1.1)
46
+ addressable (2.3.6)
47
+ airborne (0.1.1)
48
+ activesupport (>= 4.0.1)
49
+ rack-test (~> 0.6, >= 0.6.2)
50
+ rest-client (~> 1.7, >= 1.7.2)
51
+ rspec (~> 3.1, >= 3.1.0)
52
+ arel (5.0.1.20140414130214)
53
+ axiom-types (0.1.1)
54
+ descendants_tracker (~> 0.0.4)
55
+ ice_nine (~> 0.11.0)
56
+ thread_safe (~> 0.3, >= 0.3.1)
57
+ builder (3.2.2)
58
+ capybara (2.4.4)
59
+ mime-types (>= 1.16)
60
+ nokogiri (>= 1.3.3)
61
+ rack (>= 1.0.0)
62
+ rack-test (>= 0.5.4)
63
+ xpath (~> 2.0)
64
+ celluloid (0.16.0)
65
+ timers (~> 4.0.0)
66
+ childprocess (0.5.5)
67
+ ffi (~> 1.0, >= 1.0.11)
68
+ cliver (0.3.2)
69
+ coderay (1.1.0)
70
+ coercible (1.0.0)
71
+ descendants_tracker (~> 0.0.1)
72
+ cookiejar (0.3.2)
73
+ cucumber (1.3.17)
74
+ builder (>= 2.1.2)
75
+ diff-lcs (>= 1.1.3)
76
+ gherkin (~> 2.12)
77
+ multi_json (>= 1.7.5, < 2.0)
78
+ multi_test (>= 0.1.1)
79
+ daemons (1.1.9)
80
+ descendants_tracker (0.0.4)
81
+ thread_safe (~> 0.3, >= 0.3.1)
82
+ diff-lcs (1.2.5)
83
+ docile (1.1.5)
84
+ em-http-request (1.1.2)
85
+ addressable (>= 2.3.4)
86
+ cookiejar
87
+ em-socksify (>= 0.3)
88
+ eventmachine (>= 1.0.3)
89
+ http_parser.rb (>= 0.6.0)
90
+ em-socksify (0.3.0)
91
+ eventmachine (>= 1.0.0.beta.4)
92
+ em-synchrony (1.0.3)
93
+ eventmachine (>= 1.0.0.beta.1)
94
+ equalizer (0.0.9)
95
+ erubis (2.7.0)
96
+ eventmachine (1.0.3)
97
+ eventmachine_httpserver (0.2.1)
98
+ faker (1.2.0)
99
+ i18n (~> 0.5)
100
+ faraday (0.9.0)
101
+ multipart-post (>= 1.2, < 3)
102
+ ffi (1.9.6)
103
+ ffi (1.9.6-x86-mingw32)
104
+ flavour_saver (0.3.3)
105
+ rltk (~> 2.2.0)
106
+ tilt
107
+ formatador (0.2.5)
108
+ gherkin (2.12.2)
109
+ multi_json (~> 1.3)
110
+ gherkin (2.12.2-x86-mingw32)
111
+ multi_json (~> 1.3)
112
+ grape (0.9.0)
113
+ activesupport
114
+ builder
115
+ hashie (>= 2.1.0)
116
+ multi_json (>= 1.3.2)
117
+ multi_xml (>= 0.5.2)
118
+ rack (>= 1.3.0)
119
+ rack-accept
120
+ rack-mount
121
+ virtus (>= 1.0.0)
122
+ grape-kaminari (0.1.6)
123
+ grape
124
+ kaminari
125
+ guard (2.6.1)
126
+ formatador (>= 0.2.4)
127
+ listen (~> 2.7)
128
+ lumberjack (~> 1.0)
129
+ pry (>= 0.9.12)
130
+ thor (>= 0.18.1)
131
+ hashie (3.3.1)
132
+ hitimes (1.2.2)
133
+ http_parser.rb (0.6.0)
134
+ i18n (0.6.11)
135
+ ice_nine (0.11.0)
136
+ json (1.8.1)
137
+ kaminari (0.16.1)
138
+ actionpack (>= 3.0.0)
139
+ activesupport (>= 3.0.0)
140
+ listen (2.7.11)
141
+ celluloid (>= 0.15.2)
142
+ rb-fsevent (>= 0.9.3)
143
+ rb-inotify (>= 0.9)
144
+ lumberjack (1.0.9)
145
+ method_source (0.8.2)
146
+ mime-types (2.4.3)
147
+ mini_portile (0.6.0)
148
+ minitest (5.4.2)
149
+ multi_json (1.10.1)
150
+ multi_test (0.1.1)
151
+ multi_xml (0.5.5)
152
+ multipart-post (2.0.0)
153
+ netrc (0.8.0)
154
+ nokogiri (1.6.3.1)
155
+ mini_portile (= 0.6.0)
156
+ nokogiri (1.6.3.1-x86-mingw32)
157
+ mini_portile (= 0.6.0)
158
+ poltergeist (1.5.1)
159
+ capybara (~> 2.1)
160
+ cliver (~> 0.3.1)
161
+ multi_json (~> 1.0)
162
+ websocket-driver (>= 0.2.0)
163
+ pry (0.10.1)
164
+ coderay (~> 1.1.0)
165
+ method_source (~> 0.8.1)
166
+ slop (~> 3.4)
167
+ pry (0.10.1-x86-mingw32)
168
+ coderay (~> 1.1.0)
169
+ method_source (~> 0.8.1)
170
+ slop (~> 3.4)
171
+ win32console (~> 1.3)
172
+ rack (1.5.2)
173
+ rack-accept (0.4.5)
174
+ rack (>= 0.4)
175
+ rack-mount (0.8.3)
176
+ rack (>= 1.0.0)
177
+ rack-parser (0.6.1)
178
+ rack
179
+ rack-test (0.6.2)
180
+ rack (>= 1.0)
181
+ rake (10.1.0)
182
+ rb-fsevent (0.9.4)
183
+ rb-inotify (0.9.5)
184
+ ffi (>= 0.5.0)
185
+ require_all (1.3.2)
186
+ rest-client (1.7.2)
187
+ mime-types (>= 1.16, < 3.0)
188
+ netrc (~> 0.7)
189
+ rest-client (1.7.2-x86-mingw32)
190
+ ffi (~> 1.9)
191
+ mime-types (>= 1.16, < 3.0)
192
+ netrc (~> 0.7)
193
+ rltk (2.2.1)
194
+ ffi (>= 1.0.0)
195
+ rspec (3.1.0)
196
+ rspec-core (~> 3.1.0)
197
+ rspec-expectations (~> 3.1.0)
198
+ rspec-mocks (~> 3.1.0)
199
+ rspec-core (3.1.7)
200
+ rspec-support (~> 3.1.0)
201
+ rspec-expectations (3.1.2)
202
+ diff-lcs (>= 1.2.0, < 2.0)
203
+ rspec-support (~> 3.1.0)
204
+ rspec-mocks (3.1.3)
205
+ rspec-support (~> 3.1.0)
206
+ rspec-support (3.1.2)
207
+ rubyzip (1.1.6)
208
+ selenium-webdriver (2.43.0)
209
+ childprocess (~> 0.5)
210
+ multi_json (~> 1.0)
211
+ rubyzip (~> 1.0)
212
+ websocket (~> 1.0)
213
+ shoulda-matchers (2.7.0)
214
+ activesupport (>= 3.0.0)
215
+ simplecov (0.9.1)
216
+ docile (~> 1.1.0)
217
+ multi_json (~> 1.0)
218
+ simplecov-html (~> 0.8.0)
219
+ simplecov-html (0.8.0)
220
+ slop (3.6.0)
221
+ sqlite3 (1.3.10)
222
+ thin (1.6.2)
223
+ daemons (>= 1.0.9)
224
+ eventmachine (>= 1.0.0)
225
+ rack (>= 1.0.0)
226
+ thor (0.19.1)
227
+ thread_safe (0.3.4)
228
+ tilt (2.0.1)
229
+ timers (4.0.1)
230
+ hitimes
231
+ tzinfo (1.2.2)
232
+ thread_safe (~> 0.1)
233
+ virtus (1.0.3)
234
+ axiom-types (~> 0.1)
235
+ coercible (~> 1.0)
236
+ descendants_tracker (~> 0.0, >= 0.0.3)
237
+ equalizer (~> 0.0, >= 0.0.9)
238
+ websocket (1.2.1)
239
+ websocket-driver (0.3.5)
240
+ win32console (1.3.2-x86-mingw32)
241
+ xpath (2.0.0)
242
+ nokogiri (~> 1.3)
243
+ yard (0.8.7.6)
244
+
245
+ PLATFORMS
246
+ ruby
247
+ x86-mingw32
248
+
249
+ DEPENDENCIES
250
+ agile-proxy!
251
+ airborne
252
+ cucumber
253
+ faker
254
+ faraday (~> 0.9.0)
255
+ guard
256
+ poltergeist
257
+ pry
258
+ rack (~> 1.5.2)
259
+ rake
260
+ rb-inotify
261
+ require_all
262
+ rest-client
263
+ rspec (~> 3.1.0)
264
+ rspec-mocks (~> 3.1.3)
265
+ selenium-webdriver (~> 2.43.0)
266
+ simplecov
267
+ yard
data/Guardfile ADDED
@@ -0,0 +1,20 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', version: 2 do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { 'spec' }
8
+
9
+ # Rails example
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
14
+ watch('config/routes.rb') { 'spec/routing' }
15
+ watch('app/controllers/application_controller.rb') { 'spec/controllers' }
16
+
17
+ # Turnip features and steps
18
+ watch(%r{^spec/acceptance/(.+)\.feature$})
19
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
20
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Olly Smith
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # agile-proxy
2
+
3
+ A proxy server intended for use during development or in integration test environments such as selenium.
4
+
5
+ Either the developer or the test suite can constantly change the response from a particular 'route' or URL via
6
+ either the built in user interface or using REST calls. An adapter is currently written for nodejs to provide easy
7
+ access to the REST interface - others are to follow.
8
+
9
+ So, you may be used to being able to stub methods in your unit tests, you can now stub http requests in your integration
10
+ tests too. It doesn't matter if you are using ruby, nodejs, java, scala ... the list goes on. As long as your 'HTTP Client'
11
+ (whether its a browser, or some form of programatic access to HTTP) supports a proxy, then you can use this.
12
+
13
+ This has many uses, the main one that I currently use this for is for developing a user interface when the server side
14
+ code is either a work in progress or not developed yet.
15
+ Even if you are not into writing integration tests for your UI layer and prefer to just write code and test manually
16
+ (which of course I do not recommend, but some people like working that way), then you can go to the user interface
17
+ and simply tell the system what you want your fake server to look like -
18
+
19
+ for example :- "When anything requests http://www.bing.com" then return "A fake bing page".
20
+
21
+ A particularly poor example, but hopefully demonstrates the idea.
22
+
23
+ ## Overview
24
+
25
+ The proxy sits between the client (maybe a browser) and the server. You can either configure the browser manually to do so
26
+ or via the selenium API if you are writing an integration test using selenium.
27
+ Requests can simply pass through, or be intercepted in some way.
28
+ By default, all requests pass through untouched.
29
+ The magic then happens when the developer informs the proxy how to respond to various requests. This
30
+ can either be done using a JSON API or using the Web Based User Interface.
31
+
32
+ Requests are matched either exactly (for example 'http://www.google.com'), or using router pattern matching
33
+ (similar to rails or other MVC frameworks).
34
+
35
+ Response bodies can be set along with any header values, status code etc..
36
+
37
+ Client drivers are available for the following languages :-
38
+
39
+ ruby
40
+ javascript (node.js)
41
+
42
+ And will soon be available for :-
43
+
44
+ javascript (browser based)
45
+ java
46
+ scala
47
+ python
48
+
49
+ ## Example Client Code
50
+ To any puffing-billy users, this will look familiar as this project is inspired by puffing-billy.
51
+
52
+ ```ruby
53
+ it 'should stub google' do
54
+ proxy.stub('http://www.google.com/').and_return(:text => "I'm not Google!")
55
+ visit 'http://www.google.com/'
56
+ page.should have_content("I'm not Google!")
57
+ end
58
+ ```
59
+
60
+ ## Installation
61
+
62
+ $ gem install agile-proxy
63
+
64
+ If you want to use the built in user interface, you must have nodejs installed along with npm. Once you have this,
65
+ install bower (unless you already have it) using the followig command line :-
66
+
67
+ npm install -g bower
68
+
69
+ Once bower is installed, install the bower modules using the following command line :-
70
+
71
+ bower install
72
+
73
+ Thats it - all done.
74
+
75
+ ## Starting the server
76
+
77
+ agile_proxy start
78
+
79
+ This will start the server with default options.
80
+
81
+ ## Contributing
82
+
83
+ 1. Fork it
84
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
85
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
86
+ 4. Push to the branch (`git push origin my-new-feature`)
87
+ 5. Create new Pull Request
88
+
89
+ ## TODO
90
+
91
+ 1. Asserting requests were made to specific urls and that they contained the correct parameters
92
+ 2. Route matching on URL parameters from the query string
93
+