webspicy 0.16.1 → 0.16.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 445a2cc26015bc9a25efcbef22a2611aedc4d6fa5ff57fdbeac0aeed8447cdb6
4
- data.tar.gz: 94e713312855382b55b55d6a1709635900426bc8d9929fefa22d79207cbb5ae0
3
+ metadata.gz: 9109121647b9e9d4ed854078e12b81d5289b53d556e7c66ca671bd628435fa63
4
+ data.tar.gz: d6cfaf0f501d554066514a500de0a32a807eaacadaefe9722fb3d76b30b7d640
5
5
  SHA512:
6
- metadata.gz: 33afca9646dec9268ed8fc5581f9a10cd73fce7cd170b8f999bb43d6c66e94f1decc9161803134d7885d5ee27a1f4d262511faaed7ffb3b9da4ba92e93b95ee2
7
- data.tar.gz: e11ab7abb09d9a8796e9946b2424b9bd11c46e82f9ab43219fdfec2ba969580fa5a6d5e89d202d17494f9f7d659990efdd8428f0a730770d5d1ccccbc79996f1
6
+ metadata.gz: bc0bbca8b1d924baaf23d87ab88b03e95e1111a936bd246200927770e89e512499cc7fb4871e46bf48929ad7f5025ce95ba891df5f01ba0232397e0446e8c701
7
+ data.tar.gz: 0c6cc0a0229167d84411da604af6549f6a4ac9a464a9ab208cf134a6b2b712a10b78e9ca353254830eeb20a092c31e1f1ad5d2ef1b048383d550dd1f17f56b44
data/README.md CHANGED
@@ -60,7 +60,7 @@ to use our `:tester` docker image. Just mount your test suite as a volume
60
60
  in `/home/app` and you are good to go:
61
61
 
62
62
  ```
63
- docker run -v path/to/tests:/formalspec enspirit/webspicy-tester
63
+ docker run -v path/to/tests:/formalspec enspirit/webspicy:tester
64
64
  ```
65
65
 
66
66
  If your plan is to test a backend that runs on your own machine (vs.
@@ -69,7 +69,7 @@ you will need to add some networking option, as shown below. Please
69
69
  refer to Docker documentation.
70
70
 
71
71
  ```
72
- docker run -v path/to/tests:/formalspec --network=host enspirit/webspicy-tester
72
+ docker run -v path/to/tests:/formalspec --network=host enspirit/webspicy:tester
73
73
  ```
74
74
 
75
75
  ## Contributing
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- webspicy (0.16.1)
4
+ webspicy (0.16.2)
5
5
  colorize (~> 0.8.1)
6
6
  finitio (~> 0.9.0)
7
7
  http (>= 2)
@@ -1,34 +1,30 @@
1
1
  ---
2
- name: |-
3
- Your backend is broken website
4
-
5
2
  url: |-
6
3
  http://yourbackendisbroken.dev
7
4
 
8
- services:
9
- - method: |-
10
- GET
5
+ method: |-
6
+ GET
11
7
 
12
- description: |-
13
- Redirects to the https version
8
+ description: |-
9
+ Redirects to the https version
14
10
 
15
- input_schema: |-
16
- Any
11
+ input_schema: |-
12
+ Any
17
13
 
18
- output_schema: |-
19
- Any
14
+ output_schema: |-
15
+ Any
20
16
 
21
- error_schema: |-
22
- Any
17
+ error_schema: |-
18
+ Any
23
19
 
24
- examples:
20
+ examples:
25
21
 
26
- - description: |-
27
- it works
28
- params:
29
- id: 1
30
- expected:
31
- content_type: text/html
32
- status: 3xx
33
- headers:
34
- Location: https://yourbackendisbroken.dev/?id=1
22
+ - description: |-
23
+ it works
24
+ params:
25
+ id: 1
26
+ expected:
27
+ content_type: text/html
28
+ status: 3xx
29
+ headers:
30
+ Location: https://yourbackendisbroken.dev/?id=1
@@ -1,34 +1,30 @@
1
1
  ---
2
- name: |-
3
- Your backend is broken website
4
-
5
2
  url: |-
6
3
  https://yourbackendisbroken.dev
7
4
 
8
- services:
9
- - method: |-
10
- GET
5
+ method: |-
6
+ GET
11
7
 
12
- description: |-
13
- Returns the web page
8
+ description: |-
9
+ Returns the web page
14
10
 
15
- input_schema: |-
16
- Any
11
+ input_schema: |-
12
+ Any
17
13
 
18
- output_schema: |-
19
- Any
14
+ output_schema: |-
15
+ Any
20
16
 
21
- error_schema: |-
22
- Any
17
+ error_schema: |-
18
+ Any
23
19
 
24
- examples:
20
+ examples:
25
21
 
26
- - description: |-
27
- it works
28
- params:
29
- id: 1
30
- expected:
31
- content_type: text/html
32
- status: 200
33
- assert:
34
- - notEmpty
22
+ - description: |-
23
+ it works
24
+ params:
25
+ id: 1
26
+ expected:
27
+ content_type: text/html
28
+ status: 200
29
+ assert:
30
+ - notEmpty
@@ -89,9 +89,9 @@ module Webspicy
89
89
  module_function :test_case
90
90
 
91
91
  def handle_finitio_error(ex, scope)
92
- # msg = "#{ex.message}:\n #{ex.root_cause.message}"
93
- # msg = Support::Colorize.colorize_error(msg, scope.config)
94
- # fatal(msg)
92
+ msg = "#{ex.message}:\n #{ex.root_cause.message}"
93
+ msg = Support::Colorize.colorize_error(msg, scope.config)
94
+ fatal(msg)
95
95
  raise
96
96
  end
97
97
  module_function :handle_finitio_error
@@ -18,14 +18,9 @@ FileUpload =
18
18
  }
19
19
 
20
20
  Specification = .Webspicy::Specification
21
- <info> {
22
- name: String
23
- url: String
24
- services: [Service]
25
- }
26
21
  <singleservice> {
27
22
  name :? String
28
- url : String
23
+ url : String
29
24
  method : Method
30
25
  description : String
31
26
  preconditions :? [String]|String
@@ -38,6 +33,11 @@ Specification = .Webspicy::Specification
38
33
  examples :? [TestCase]
39
34
  counterexamples :? [TestCase]
40
35
  }
36
+ <info> {
37
+ name: String
38
+ url: String
39
+ services: [Service]
40
+ }
41
41
 
42
42
  Service =
43
43
  .Webspicy::Specification::Service <info> {
@@ -0,0 +1,5 @@
1
+ require "webspicy"
2
+ require "webspicy/mocker"
3
+ require 'rack'
4
+ config = Webspicy::Configuration.dress(Path("/formalspec/"))
5
+ run Webspicy::Mocker.new(config)
@@ -14,11 +14,13 @@ module Webspicy
14
14
 
15
15
  def self.singleservice(raw)
16
16
  converted = {
17
- name: raw.has_key?(:name) ? raw[:name] : "Unamed specification",
17
+ name: raw[:name] || "Unamed specification",
18
18
  url: raw[:url],
19
- services: [raw.reject{|k, _| k == :name || k == :url}]
19
+ services: [
20
+ Webspicy.service(raw.reject{|k| k==:url or k==:name }, Webspicy.current_scope)
21
+ ]
20
22
  }
21
- self.info(raw)
23
+ info(converted)
22
24
  end
23
25
 
24
26
  def located_at!(location)
@@ -2,7 +2,7 @@ module Webspicy
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 16
5
- TINY = 1
5
+ TINY = 2
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webspicy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.1
4
+ version: 0.16.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
@@ -245,6 +245,7 @@ files:
245
245
  - lib/webspicy/configuration/single_yml_file.rb
246
246
  - lib/webspicy/formaldoc.fio
247
247
  - lib/webspicy/mocker.rb
248
+ - lib/webspicy/mocker/config.ru
248
249
  - lib/webspicy/openapi.rb
249
250
  - lib/webspicy/openapi/generator.rb
250
251
  - lib/webspicy/specification.rb