webspicy 0.20.4 → 0.20.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/bin/webspicy +2 -2
  3. data/lib/finitio/webspicy/shared.fio +10 -0
  4. data/lib/webspicy.rb +22 -53
  5. data/lib/webspicy/configuration.rb +3 -1
  6. data/lib/webspicy/configuration/scope.rb +2 -2
  7. data/lib/webspicy/configuration/single_url.rb +35 -25
  8. data/lib/webspicy/configuration/single_yml_file.rb +7 -2
  9. data/lib/webspicy/specification.rb +5 -56
  10. data/lib/webspicy/specification/service.rb +1 -5
  11. data/lib/webspicy/specification/test_case.rb +0 -49
  12. data/lib/webspicy/support/colorize.rb +1 -1
  13. data/lib/webspicy/tester.rb +5 -3
  14. data/lib/webspicy/tester/fakesmtp.rb +1 -1
  15. data/lib/webspicy/tester/fakesmtp/email.rb +13 -0
  16. data/lib/webspicy/tester/file_checker.rb +1 -1
  17. data/lib/webspicy/tester/reporter.rb +2 -1
  18. data/lib/webspicy/tester/reporter/documentation.rb +11 -5
  19. data/lib/webspicy/tester/reporter/exceptions.rb +3 -1
  20. data/lib/webspicy/tester/reporter/junit_xml_file.rb +151 -0
  21. data/lib/webspicy/tester/reporter/progress.rb +1 -1
  22. data/lib/webspicy/tester/reporter/success_or_not.rb +14 -0
  23. data/lib/webspicy/tester/reporter/summary.rb +6 -2
  24. data/lib/webspicy/tester/result.rb +1 -0
  25. data/lib/webspicy/version.rb +1 -1
  26. data/lib/webspicy/web.rb +46 -0
  27. data/lib/webspicy/{formaldoc.fio → web/formaldoc.fio} +5 -13
  28. data/lib/webspicy/web/specification.rb +68 -0
  29. data/lib/webspicy/web/specification/file_upload.rb +39 -0
  30. data/lib/webspicy/web/specification/service.rb +13 -0
  31. data/lib/webspicy/web/specification/test_case.rb +58 -0
  32. data/spec/unit/configuration/scope/test_expand_example.rb +11 -5
  33. data/spec/unit/specification/pre/test_global_request_headers.rb +3 -3
  34. data/spec/unit/specification/service/test_dress_params.rb +2 -2
  35. data/spec/unit/test_configuration.rb +1 -0
  36. data/spec/unit/tester/fakesmtp/test_email.rb +93 -0
  37. data/spec/unit/web/specification/test_instantiate_url.rb +36 -0
  38. data/spec/unit/web/specification/test_url_placeholders.rb +23 -0
  39. data/tasks/test.rake +5 -1
  40. metadata +40 -23
  41. data/lib/webspicy/specification/file_upload.rb +0 -37
  42. data/lib/webspicy/tester/reporter/error_count.rb +0 -29
  43. data/spec/blackbox/commandline.yml +0 -24
  44. data/spec/blackbox/fixtures/passing/config.rb +0 -9
  45. data/spec/blackbox/fixtures/passing/formaldef/get.yml +0 -30
  46. data/spec/unit/specification/test_instantiate_url.rb +0 -34
  47. data/spec/unit/specification/test_url_placeholders.rb +0 -21
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webspicy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.4
4
+ version: 0.20.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-13 00:00:00.000000000 Z
11
+ date: 2021-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -126,22 +126,22 @@ dependencies:
126
126
  name: rack-robustness
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '1.1'
132
129
  - - ">="
133
130
  - !ruby/object:Gem::Version
134
131
  version: 1.1.0
132
+ - - "~>"
133
+ - !ruby/object:Gem::Version
134
+ version: '1.1'
135
135
  type: :runtime
136
136
  prerelease: false
137
137
  version_requirements: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - "~>"
140
- - !ruby/object:Gem::Version
141
- version: '1.1'
142
139
  - - ">="
143
140
  - !ruby/object:Gem::Version
144
141
  version: 1.1.0
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '1.1'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: mustermann
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -171,19 +171,19 @@ dependencies:
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  - !ruby/object:Gem::Dependency
174
- name: colorize
174
+ name: paint
175
175
  requirement: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: 0.8.1
179
+ version: '2.2'
180
180
  type: :runtime
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: 0.8.1
186
+ version: '2.2'
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: openapi3_parser
189
189
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +198,20 @@ dependencies:
198
198
  - - "~>"
199
199
  - !ruby/object:Gem::Version
200
200
  version: 0.8.2
201
+ - !ruby/object:Gem::Dependency
202
+ name: mustache
203
+ requirement: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - "~>"
206
+ - !ruby/object:Gem::Version
207
+ version: '1.0'
208
+ type: :runtime
209
+ prerelease: false
210
+ version_requirements: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - "~>"
213
+ - !ruby/object:Gem::Version
214
+ version: '1.0'
201
215
  description: Webspicy helps testing web services as software operation black boxes
202
216
  email: blambeau@gmail.com
203
217
  executables:
@@ -214,16 +228,15 @@ files:
214
228
  - doc/3-specification-importance.md
215
229
  - doc/4-sequence-diagram.md
216
230
  - lib/finitio/webspicy/scalars.fio
231
+ - lib/finitio/webspicy/shared.fio
217
232
  - lib/webspicy.rb
218
233
  - lib/webspicy/configuration.rb
219
234
  - lib/webspicy/configuration/scope.rb
220
235
  - lib/webspicy/configuration/single_url.rb
221
236
  - lib/webspicy/configuration/single_yml_file.rb
222
- - lib/webspicy/formaldoc.fio
223
237
  - lib/webspicy/specification.rb
224
238
  - lib/webspicy/specification/condition.rb
225
239
  - lib/webspicy/specification/err.rb
226
- - lib/webspicy/specification/file_upload.rb
227
240
  - lib/webspicy/specification/oldies.rb
228
241
  - lib/webspicy/specification/oldies/bridge.rb
229
242
  - lib/webspicy/specification/oldies/errcondition.rb
@@ -257,11 +270,12 @@ files:
257
270
  - lib/webspicy/tester/reporter.rb
258
271
  - lib/webspicy/tester/reporter/composite.rb
259
272
  - lib/webspicy/tester/reporter/documentation.rb
260
- - lib/webspicy/tester/reporter/error_count.rb
261
273
  - lib/webspicy/tester/reporter/exceptions.rb
262
274
  - lib/webspicy/tester/reporter/file_progress.rb
263
275
  - lib/webspicy/tester/reporter/file_summary.rb
276
+ - lib/webspicy/tester/reporter/junit_xml_file.rb
264
277
  - lib/webspicy/tester/reporter/progress.rb
278
+ - lib/webspicy/tester/reporter/success_or_not.rb
265
279
  - lib/webspicy/tester/reporter/summary.rb
266
280
  - lib/webspicy/tester/result.rb
267
281
  - lib/webspicy/tester/result/assert_met.rb
@@ -279,14 +293,16 @@ files:
279
293
  - lib/webspicy/web/client/http_client.rb
280
294
  - lib/webspicy/web/client/rack_test_client.rb
281
295
  - lib/webspicy/web/client/support.rb
296
+ - lib/webspicy/web/formaldoc.fio
282
297
  - lib/webspicy/web/invocation.rb
283
298
  - lib/webspicy/web/mocker.rb
284
299
  - lib/webspicy/web/mocker/config.ru
285
300
  - lib/webspicy/web/openapi.rb
286
301
  - lib/webspicy/web/openapi/generator.rb
287
- - spec/blackbox/commandline.yml
288
- - spec/blackbox/fixtures/passing/config.rb
289
- - spec/blackbox/fixtures/passing/formaldef/get.yml
302
+ - lib/webspicy/web/specification.rb
303
+ - lib/webspicy/web/specification/file_upload.rb
304
+ - lib/webspicy/web/specification/service.rb
305
+ - lib/webspicy/web/specification/test_case.rb
290
306
  - spec/spec_helper.rb
291
307
  - spec/unit/configuration/config.rb
292
308
  - spec/unit/configuration/scope/test_each_service.rb
@@ -297,8 +313,6 @@ files:
297
313
  - spec/unit/specification/service/test_dress_params.rb
298
314
  - spec/unit/specification/test_case/test_mutate.rb
299
315
  - spec/unit/specification/test_condition.rb
300
- - spec/unit/specification/test_instantiate_url.rb
301
- - spec/unit/specification/test_url_placeholders.rb
302
316
  - spec/unit/support/hooks/test_fire_after_each.rb
303
317
  - spec/unit/support/hooks/test_fire_around.rb
304
318
  - spec/unit/support/hooks/test_fire_before_each.rb
@@ -310,17 +324,20 @@ files:
310
324
  - spec/unit/support/world/test_world.rb
311
325
  - spec/unit/test_configuration.rb
312
326
  - spec/unit/tester/fakeses/test_email.rb
327
+ - spec/unit/tester/fakesmtp/test_email.rb
313
328
  - spec/unit/tester/test_asserter.rb
314
329
  - spec/unit/tester/test_assertions.rb
315
330
  - spec/unit/web/mocker/test_mocker.rb
316
331
  - spec/unit/web/openapi/test_generator.rb
332
+ - spec/unit/web/specification/test_instantiate_url.rb
333
+ - spec/unit/web/specification/test_url_placeholders.rb
317
334
  - tasks/gem.rake
318
335
  - tasks/test.rake
319
336
  homepage: http://github.com/enspirit/webspicy
320
337
  licenses:
321
338
  - MIT
322
339
  metadata: {}
323
- post_install_message:
340
+ post_install_message:
324
341
  rdoc_options: []
325
342
  require_paths:
326
343
  - lib
@@ -335,8 +352,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
335
352
  - !ruby/object:Gem::Version
336
353
  version: '0'
337
354
  requirements: []
338
- rubygems_version: 3.1.4
339
- signing_key:
355
+ rubygems_version: 3.0.8
356
+ signing_key:
340
357
  specification_version: 4
341
358
  summary: Webspicy helps testing web services as software operation black boxes!
342
359
  test_files: []
@@ -1,37 +0,0 @@
1
- module Webspicy
2
- class Specification
3
- class FileUpload
4
-
5
- def initialize(raw)
6
- @path = raw[:path]
7
- @content_type = raw[:content_type]
8
- @param_name = raw[:param_name] || "file"
9
- end
10
-
11
- attr_reader :path, :content_type, :param_name
12
-
13
- def self.info(raw)
14
- new(raw)
15
- end
16
-
17
- def locate(specification)
18
- FileUpload.new({
19
- path: specification.locate(path),
20
- content_type: content_type
21
- })
22
- end
23
-
24
- def to_info
25
- { path: path.to_s,
26
- content_type: content_type,
27
- param_name: param_name }
28
- end
29
-
30
- def to_s
31
- "FileUpload(#{to_info})"
32
- end
33
- alias :inspect :to_s
34
-
35
- end # class FileUpload
36
- end # class Specification
37
- end # module Webspicy
@@ -1,29 +0,0 @@
1
- module Webspicy
2
- class Tester
3
- class Reporter
4
- class ErrorCount < Reporter
5
-
6
- def initialize(*args, &bl)
7
- super
8
- @errors = Hash.new{|h,k| 0 }
9
- end
10
- attr_reader :errors
11
-
12
- [
13
- :spec_file_error,
14
- :check_error,
15
- :check_failure
16
- ].each do |meth|
17
- define_method(meth) do |*args, &bl|
18
- @errors[meth] += 1
19
- end
20
- end
21
-
22
- def report
23
- @errors.values.inject(0){|memo,x| memo+x }
24
- end
25
-
26
- end # class ErrorCount
27
- end # class Reporter
28
- end # class Tester
29
- end # module Webspicy
@@ -1,24 +0,0 @@
1
- ---
2
- command:
3
- webspicy {options} {args}
4
-
5
- examples:
6
-
7
- - description: |-
8
- when called on a passing path
9
- args:
10
- - ./fixtures/passing/config.rb
11
- assert:
12
- exit_code:
13
- 0
14
- stdout: |-
15
- GET /, when requested
16
- v It has a 200 response status
17
- v It has a `Content-Type: application/json` response header
18
- v Its output meets the expected data schema
19
- v Assert notEmpty
20
- v Assert pathFD('', :hello => "World" )
21
-
22
-
23
- 1 spec file, 1 example, 0 counterexample
24
- 5 assertions, 0 error, 0 failure
@@ -1,9 +0,0 @@
1
- Webspicy::Configuration.new(Path.dir) do |c|
2
- app = ->(env){
3
- [ 200,
4
- {"Content-Type" => "application/json"},
5
- [ {hello: "World"}.to_json ]
6
- ]
7
- }
8
- c.client = Webspicy::Tester::RackTestClient.for(app)
9
- end
@@ -1,30 +0,0 @@
1
- ---
2
- url: |-
3
- /
4
-
5
- method: |-
6
- GET
7
-
8
- description: |-
9
- Returns hello world
10
-
11
- input_schema: |-
12
- { }
13
-
14
- output_schema: |-
15
- { hello: String }
16
-
17
- error_schema: |-
18
- .
19
-
20
- examples:
21
-
22
- - description: |-
23
- when requested
24
- params: {}
25
- expected:
26
- content_type: application/json
27
- status: 200
28
- assert:
29
- - notEmpty
30
- - pathFD('', :hello => "World" )
@@ -1,34 +0,0 @@
1
- require "spec_helper"
2
- module Webspicy
3
- describe Specification, "instantiate_url" do
4
-
5
- it 'does nothing when the url has no placeholder' do
6
- r = Specification.new(url: "/test/a/url")
7
- url, params = r.instantiate_url(foo: "bar")
8
- expect(url).to eq("/test/a/url")
9
- expect(params).to eq(foo: "bar")
10
- end
11
-
12
- it 'instantiates placeholders and strips corresponding params' do
13
- r = Specification.new(url: "/test/{foo}/url")
14
- url, params = r.instantiate_url(foo: "bar", baz: "coz")
15
- expect(url).to eq("/test/bar/url")
16
- expect(params).to eq(baz: "coz")
17
- end
18
-
19
- it 'instantiates placeholders and strips corresponding params even when multiple' do
20
- r = Specification.new(url: "/test/{foo}/url/{bar}")
21
- url, params = r.instantiate_url(foo: "bar", bar: "baz", baz: "coz")
22
- expect(url).to eq("/test/bar/url/baz")
23
- expect(params).to eq(baz: "coz")
24
- end
25
-
26
- it 'supports placeholders corresponding to subentities' do
27
- r = Specification.new(url: "/test/{foo.id}/url")
28
- url, params = r.instantiate_url(foo: {id: "bar"}, baz: "coz")
29
- expect(url).to eq("/test/bar/url")
30
- expect(params).to eq(foo: {}, baz: "coz")
31
- end
32
-
33
- end
34
- end
@@ -1,21 +0,0 @@
1
- require "spec_helper"
2
- module Webspicy
3
- describe Specification, "url_placeholders" do
4
-
5
- it 'returns an empty array on none' do
6
- r = Specification.new(url: "/test/a/url")
7
- expect(r.url_placeholders).to eq([])
8
- end
9
-
10
- it 'returns all placeholders' do
11
- r = Specification.new(url: "/test/{foo}/url/{bar}")
12
- expect(r.url_placeholders).to eq(["foo", "bar"])
13
- end
14
-
15
- it 'returns all placeholders expr' do
16
- r = Specification.new(url: "/test/{foo.id}/url/{bar}")
17
- expect(r.url_placeholders).to eq(["foo.id", "bar"])
18
- end
19
-
20
- end
21
- end