webspicy 0.20.2 → 0.20.7
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.
- checksums.yaml +4 -4
- data/bin/webspicy +3 -4
- data/lib/finitio/webspicy/shared.fio +10 -0
- data/lib/webspicy.rb +22 -53
- data/lib/webspicy/configuration.rb +17 -0
- data/lib/webspicy/configuration/scope.rb +3 -2
- data/lib/webspicy/configuration/single_url.rb +35 -25
- data/lib/webspicy/configuration/single_yml_file.rb +7 -2
- data/lib/webspicy/specification.rb +0 -55
- data/lib/webspicy/specification/post/missing_condition_impl.rb +2 -2
- data/lib/webspicy/specification/post/unexpected_condition_impl.rb +2 -2
- data/lib/webspicy/specification/service.rb +1 -5
- data/lib/webspicy/specification/test_case.rb +0 -49
- data/lib/webspicy/support/colorize.rb +7 -1
- data/lib/webspicy/tester.rb +15 -19
- data/lib/webspicy/tester/fakesmtp.rb +1 -1
- data/lib/webspicy/tester/fakesmtp/email.rb +13 -0
- data/lib/webspicy/tester/reporter.rb +5 -0
- data/lib/webspicy/tester/reporter/documentation.rb +30 -8
- data/lib/webspicy/tester/reporter/error_count.rb +11 -7
- data/lib/webspicy/tester/reporter/file_progress.rb +2 -2
- data/lib/webspicy/tester/reporter/file_summary.rb +2 -2
- data/lib/webspicy/tester/reporter/progress.rb +4 -4
- data/lib/webspicy/tester/reporter/summary.rb +8 -7
- data/lib/webspicy/tester/result/errcondition_met.rb +1 -3
- data/lib/webspicy/tester/result/postcondition_met.rb +1 -3
- data/lib/webspicy/version.rb +1 -1
- data/lib/webspicy/web.rb +46 -0
- data/lib/webspicy/{formaldoc.fio → web/formaldoc.fio} +5 -13
- data/lib/webspicy/web/specification.rb +68 -0
- data/lib/webspicy/web/specification/file_upload.rb +39 -0
- data/lib/webspicy/web/specification/service.rb +13 -0
- data/lib/webspicy/web/specification/test_case.rb +58 -0
- data/spec/unit/configuration/scope/test_expand_example.rb +11 -5
- data/spec/unit/specification/pre/test_global_request_headers.rb +3 -3
- data/spec/unit/specification/service/test_dress_params.rb +2 -2
- data/spec/unit/test_configuration.rb +1 -0
- data/spec/unit/tester/fakesmtp/test_email.rb +93 -0
- data/spec/unit/web/specification/test_instantiate_url.rb +36 -0
- data/spec/unit/web/specification/test_url_placeholders.rb +23 -0
- data/tasks/test.rake +2 -1
- metadata +15 -10
- data/lib/webspicy/specification/file_upload.rb +0 -37
- data/spec/unit/specification/test_instantiate_url.rb +0 -34
- data/spec/unit/specification/test_url_placeholders.rb +0 -21
@@ -0,0 +1,36 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
module Webspicy
|
3
|
+
module Web
|
4
|
+
describe Specification, "instantiate_url" do
|
5
|
+
|
6
|
+
it 'does nothing when the url has no placeholder' do
|
7
|
+
r = Specification.new(url: "/test/a/url")
|
8
|
+
url, params = r.instantiate_url(foo: "bar")
|
9
|
+
expect(url).to eq("/test/a/url")
|
10
|
+
expect(params).to eq(foo: "bar")
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'instantiates placeholders and strips corresponding params' do
|
14
|
+
r = Specification.new(url: "/test/{foo}/url")
|
15
|
+
url, params = r.instantiate_url(foo: "bar", baz: "coz")
|
16
|
+
expect(url).to eq("/test/bar/url")
|
17
|
+
expect(params).to eq(baz: "coz")
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'instantiates placeholders and strips corresponding params even when multiple' do
|
21
|
+
r = Specification.new(url: "/test/{foo}/url/{bar}")
|
22
|
+
url, params = r.instantiate_url(foo: "bar", bar: "baz", baz: "coz")
|
23
|
+
expect(url).to eq("/test/bar/url/baz")
|
24
|
+
expect(params).to eq(baz: "coz")
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'supports placeholders corresponding to subentities' do
|
28
|
+
r = Specification.new(url: "/test/{foo.id}/url")
|
29
|
+
url, params = r.instantiate_url(foo: {id: "bar"}, baz: "coz")
|
30
|
+
expect(url).to eq("/test/bar/url")
|
31
|
+
expect(params).to eq(foo: {}, baz: "coz")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
module Webspicy
|
3
|
+
module Web
|
4
|
+
describe Specification, "url_placeholders" do
|
5
|
+
|
6
|
+
it 'returns an empty array on none' do
|
7
|
+
r = Specification.new(url: "/test/a/url")
|
8
|
+
expect(r.url_placeholders).to eq([])
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'returns all placeholders' do
|
12
|
+
r = Specification.new(url: "/test/{foo}/url/{bar}")
|
13
|
+
expect(r.url_placeholders).to eq(["foo", "bar"])
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns all placeholders expr' do
|
17
|
+
r = Specification.new(url: "/test/{foo.id}/url/{bar}")
|
18
|
+
expect(r.url_placeholders).to eq(["foo.id", "bar"])
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/tasks/test.rake
CHANGED
@@ -18,7 +18,8 @@ namespace :test do
|
|
18
18
|
desc "Runs the integration tests on the #{file.basename} example"
|
19
19
|
task(test_name) do
|
20
20
|
Bundler.with_original_env do
|
21
|
-
system("cd #{file} && bundle exec rake")
|
21
|
+
x = system("cd #{file} && bundle exec rake")
|
22
|
+
abort("Example test suite failed: #{file}") unless x
|
22
23
|
end
|
23
24
|
end
|
24
25
|
tests << test_name
|
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
|
+
version: 0.20.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -171,19 +171,19 @@ dependencies:
|
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0'
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
|
-
name:
|
174
|
+
name: paint
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
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:
|
186
|
+
version: '2.2'
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
188
|
name: openapi3_parser
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
@@ -214,16 +214,15 @@ files:
|
|
214
214
|
- doc/3-specification-importance.md
|
215
215
|
- doc/4-sequence-diagram.md
|
216
216
|
- lib/finitio/webspicy/scalars.fio
|
217
|
+
- lib/finitio/webspicy/shared.fio
|
217
218
|
- lib/webspicy.rb
|
218
219
|
- lib/webspicy/configuration.rb
|
219
220
|
- lib/webspicy/configuration/scope.rb
|
220
221
|
- lib/webspicy/configuration/single_url.rb
|
221
222
|
- lib/webspicy/configuration/single_yml_file.rb
|
222
|
-
- lib/webspicy/formaldoc.fio
|
223
223
|
- lib/webspicy/specification.rb
|
224
224
|
- lib/webspicy/specification/condition.rb
|
225
225
|
- lib/webspicy/specification/err.rb
|
226
|
-
- lib/webspicy/specification/file_upload.rb
|
227
226
|
- lib/webspicy/specification/oldies.rb
|
228
227
|
- lib/webspicy/specification/oldies/bridge.rb
|
229
228
|
- lib/webspicy/specification/oldies/errcondition.rb
|
@@ -279,11 +278,16 @@ files:
|
|
279
278
|
- lib/webspicy/web/client/http_client.rb
|
280
279
|
- lib/webspicy/web/client/rack_test_client.rb
|
281
280
|
- lib/webspicy/web/client/support.rb
|
281
|
+
- lib/webspicy/web/formaldoc.fio
|
282
282
|
- lib/webspicy/web/invocation.rb
|
283
283
|
- lib/webspicy/web/mocker.rb
|
284
284
|
- lib/webspicy/web/mocker/config.ru
|
285
285
|
- lib/webspicy/web/openapi.rb
|
286
286
|
- lib/webspicy/web/openapi/generator.rb
|
287
|
+
- lib/webspicy/web/specification.rb
|
288
|
+
- lib/webspicy/web/specification/file_upload.rb
|
289
|
+
- lib/webspicy/web/specification/service.rb
|
290
|
+
- lib/webspicy/web/specification/test_case.rb
|
287
291
|
- spec/spec_helper.rb
|
288
292
|
- spec/unit/configuration/config.rb
|
289
293
|
- spec/unit/configuration/scope/test_each_service.rb
|
@@ -294,8 +298,6 @@ files:
|
|
294
298
|
- spec/unit/specification/service/test_dress_params.rb
|
295
299
|
- spec/unit/specification/test_case/test_mutate.rb
|
296
300
|
- spec/unit/specification/test_condition.rb
|
297
|
-
- spec/unit/specification/test_instantiate_url.rb
|
298
|
-
- spec/unit/specification/test_url_placeholders.rb
|
299
301
|
- spec/unit/support/hooks/test_fire_after_each.rb
|
300
302
|
- spec/unit/support/hooks/test_fire_around.rb
|
301
303
|
- spec/unit/support/hooks/test_fire_before_each.rb
|
@@ -307,10 +309,13 @@ files:
|
|
307
309
|
- spec/unit/support/world/test_world.rb
|
308
310
|
- spec/unit/test_configuration.rb
|
309
311
|
- spec/unit/tester/fakeses/test_email.rb
|
312
|
+
- spec/unit/tester/fakesmtp/test_email.rb
|
310
313
|
- spec/unit/tester/test_asserter.rb
|
311
314
|
- spec/unit/tester/test_assertions.rb
|
312
315
|
- spec/unit/web/mocker/test_mocker.rb
|
313
316
|
- spec/unit/web/openapi/test_generator.rb
|
317
|
+
- spec/unit/web/specification/test_instantiate_url.rb
|
318
|
+
- spec/unit/web/specification/test_url_placeholders.rb
|
314
319
|
- tasks/gem.rake
|
315
320
|
- tasks/test.rake
|
316
321
|
homepage: http://github.com/enspirit/webspicy
|
@@ -332,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
337
|
- !ruby/object:Gem::Version
|
333
338
|
version: '0'
|
334
339
|
requirements: []
|
335
|
-
rubygems_version: 3.0.
|
340
|
+
rubygems_version: 3.0.9
|
336
341
|
signing_key:
|
337
342
|
specification_version: 4
|
338
343
|
summary: Webspicy helps testing web services as software operation black boxes!
|
@@ -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,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
|