webspicy 0.21.2 → 0.21.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4ed553ffebc5521719b8ae05848942894671b9fc5599af596697bb774d3503d
4
- data.tar.gz: 40c18bb7c4f4e6549a81d9cff8f671d5dc239bca5bf44a7f205c08cde901af09
3
+ metadata.gz: ba04baed1cda2292312644692901a18bc5a24f04a27be985a27097417ed731a9
4
+ data.tar.gz: 67edeff75f3cc4064c197efbd65b2bc4533b7214033226e31092b19f21bdc355
5
5
  SHA512:
6
- metadata.gz: 0f5ca666ad6d74f5a070671bf7ec97e9f40922322b24fdbfb20767afe08b2bbd31db7801b2c5d580d6e9a5adcbc44040a5431f23943941a9828c9cea04c40b4b
7
- data.tar.gz: cbf46a595dc6365e65b38442097f617c5f845a7daea54c18aeac2a374dec46949061b5a534577a57ba68ea19bfe627abae2e6f2b9b0fa59f1ffa35ac5494316d
6
+ metadata.gz: 560122db62b3024ad5ab6c76f171438e2c45ed4bc1b23fcc9af895e444a7c86ba655826f59d1719ed3020e6bc75d224a072717391ab0862a09f37cb96f89c61a
7
+ data.tar.gz: 1ffb6d303cfcec6cc4d19c3f03c94f54acd16e50246f73171d00ab878229bf6fe16b18e4c16f9f8c139ca0557134d1b2c66af53c0c4c5cc3ef68782bd32c4710
@@ -13,6 +13,7 @@ module Webspicy
13
13
  @invocation = tester.invocation
14
14
  @assertions = []
15
15
  @failures = []
16
+ @warnings = []
16
17
  @errors = []
17
18
  if @invocation
18
19
  check!
@@ -60,7 +60,7 @@ module Webspicy
60
60
  abort("KO") unless reporter.find(Reporter::SuccessOrNot).success?
61
61
  end
62
62
 
63
- def find_and_call(method, url, mutation)
63
+ def find_and_call(method, url, mutation, config = self.config)
64
64
  unless tc = scope.find_test_case(method, url)
65
65
  raise Error, "No such service `#{method} #{url}`"
66
66
  end
@@ -2,7 +2,7 @@ module Webspicy
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 21
5
- TINY = 2
5
+ TINY = 4
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -7,17 +7,19 @@ module Webspicy
7
7
 
8
8
  def initialize(config)
9
9
  @config = Configuration.dress(config)
10
- @generator = config.generator || Finitio::Generation.new
10
+ @generator = config.generator || Finitio::Generation.new(
11
+ collection_size: 1..1
12
+ )
11
13
  end
12
14
  attr_reader :config, :generator
13
15
 
14
- def call
16
+ def call(info = {})
15
17
  {
16
18
  openapi: "3.0.2",
17
19
  info: {
18
20
  version: "1.0.0",
19
- title: "Hello API"
20
- },
21
+ title: "Webspicy Specification"
22
+ }.merge(info),
21
23
  paths: paths
22
24
  }
23
25
  end
@@ -37,7 +39,7 @@ module Webspicy
37
39
  def path_for(specification)
38
40
  {
39
41
  standardize(specification.url) => {
40
- summary: specification.name
42
+ summary: specification.name.to_s || 'API Specification'
41
43
  }.merge(verbs_for(specification))
42
44
  }
43
45
  end
@@ -49,7 +51,7 @@ module Webspicy
49
51
 
50
52
  def verbs_for(specification)
51
53
  specification.services.inject({}) do |verbs,service|
52
- verb = service.method.downcase
54
+ verb = service.method.downcase.gsub(/_form$/, '')
53
55
  verb_defn = {
54
56
  description: service.description,
55
57
  parameters: parameters_for(service),
@@ -6,23 +6,45 @@ module Webspicy
6
6
  module Web
7
7
  module Openapi
8
8
  describe Generator do
9
-
10
- let(:config) {
9
+ let(:config) do
11
10
  Configuration.new(restful_folder)
12
- }
11
+ end
13
12
 
14
- subject {
15
- ruby_objs = Generator.new(config).call
13
+ subject do
14
+ ruby_objs = Generator.new(config).call(info)
16
15
  JSON.parse(ruby_objs.to_json)
17
- }
16
+ end
18
17
 
19
- it 'works fine' do
18
+ let(:info) do
19
+ {}
20
+ end
21
+
22
+ def openapi_document
20
23
  document = Openapi3Parser.load(subject)
21
- #puts JSON.pretty_generate(subject)
22
24
  document.errors.each do |err|
23
25
  puts err.inspect
24
26
  end unless document.errors.empty?
25
- expect(document.errors).to be_empty
27
+ document
28
+ end
29
+
30
+ it 'works fine' do
31
+ expect(openapi_document.errors).to be_empty
32
+ expect(openapi_document.info.title).to eql('Webspicy Specification')
33
+ end
34
+
35
+ describe 'when passing specific info' do
36
+ let(:info) {
37
+ {
38
+ version: '1.1.1',
39
+ title: 'Webspicy API'
40
+ }
41
+ }
42
+
43
+ it 'takes it into account' do
44
+ expect(openapi_document.errors).to be_empty
45
+ expect(openapi_document.info.title).to eql('Webspicy API')
46
+ expect(openapi_document.info.version).to eql('1.1.1')
47
+ end
26
48
  end
27
49
 
28
50
  end
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.21.2
4
+ version: 0.21.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-26 00:00:00.000000000 Z
11
+ date: 2023-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -408,7 +408,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
408
408
  - !ruby/object:Gem::Version
409
409
  version: '0'
410
410
  requirements: []
411
- rubygems_version: 3.3.7
411
+ rubygems_version: 3.3.26
412
412
  signing_key:
413
413
  specification_version: 4
414
414
  summary: Webspicy helps testing web services as software operation black boxes!