webspicy 0.3.0.pre.rc1 → 0.3.0.pre.rc2

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
  SHA1:
3
- metadata.gz: 397c21900711f78462183be1dab9cba93caf6cdf
4
- data.tar.gz: 12b2b0e27ee8171922e1d032fae95b0980d21ff2
3
+ metadata.gz: d31b169f136144209e61a59ac7c7c848562e5646
4
+ data.tar.gz: 2e971cd2cf87bd7215039349257dbe6fe05d0a5c
5
5
  SHA512:
6
- metadata.gz: 2e68c059d88816ecdabf5737784aae341cd65f7891ce1db3264ac4dfbdaf6c75744b49645e94eb84597159ce241273808481d58d80e17bc0f41d42101ec838e8
7
- data.tar.gz: 36477950cfb806330fff4ee261485960e87f696d575a2d55945a10b685090832be6b452eea0b25186a23d55288197c9837c18be20816ba19b8b75b346d3ed4fc
6
+ metadata.gz: 0ac4e3b403070e46f7d85b88289cb81abc375422acf42164eab8ed70145201087bd5affb9fd94d54231f5ac388ee430ce9441f5959c9b372ebcfac2ce06a8bf4
7
+ data.tar.gz: f84f29c4023ef02e568b2c8b861a095f8ce118964ffb6cada0a3c3e1c9c6458d0ff5b4ed308e2a77edba6d64695bdb2492073c14977b3d871f72d38fbbfd7fae
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- webspicy (0.2.3)
4
+ webspicy (0.3.0.pre.rc1)
5
5
  finitio (~> 0.5.2)
6
6
  http (~> 2)
7
7
  path (~> 1.3)
@@ -7,7 +7,7 @@ module Webspicy
7
7
  attr_reader :config
8
8
 
9
9
  def call
10
- Webspicy.with_scope_for(config) do |scope|
10
+ config.each_scope do |scope|
11
11
  client = scope.get_client
12
12
  scope.each_resource_file do |file, folder|
13
13
  RSpec.describe file.relative_to(folder).to_s do
@@ -1,8 +1,9 @@
1
1
  module Webspicy
2
2
  class Configuration
3
3
 
4
- def initialize(folder = Path.pwd)
4
+ def initialize(folder = Path.pwd, parent = nil)
5
5
  @folder = folder
6
+ @parent = parent
6
7
  @children = []
7
8
  @before_listeners = []
8
9
  @rspec_options = default_rspec_options
@@ -15,6 +16,20 @@ module Webspicy
15
16
  attr_accessor :folder
16
17
  protected :folder=
17
18
 
19
+ attr_accessor :parent
20
+ protected :parent=
21
+
22
+ def each_scope(&bl)
23
+ return enum_for(:each_scope) unless block_given?
24
+ if has_children?
25
+ children.each do |config|
26
+ config.each_scope(&bl)
27
+ end
28
+ else
29
+ Webspicy.with_scope_for(self, &bl)
30
+ end
31
+ end
32
+
18
33
  # Adds a folder to the list of folders where test case definitions are
19
34
  # to be found.
20
35
  def folder(folder = nil, &bl)
@@ -25,6 +40,7 @@ module Webspicy
25
40
  raise "Folder `#{folder}` does not exists" unless folder.exists? && folder.directory?
26
41
  raise "Folder must be a descendant" unless folder.inside?(@folder)
27
42
  child = dup do |c|
43
+ c.parent = self
28
44
  c.folder = folder
29
45
  end
30
46
  yield(child) if block_given?
@@ -186,6 +202,24 @@ module Webspicy
186
202
  end
187
203
  private :default_rspec_options
188
204
 
205
+ # Returns the Data system to use for parsing schemas
206
+ #
207
+ # The data system associated with a configuration is build when the
208
+ # configuration folder contains a `schema.fio` finitio file. When no
209
+ # such file can be found, the parent config is checked (if any). When
210
+ # no `schema.fio` file can be found, the method ends up returning the
211
+ # default Finition system.
212
+ def data_system
213
+ schema = self.folder/"schema.fio"
214
+ if schema.file?
215
+ Finitio::DEFAULT_SYSTEM.parse(schema.read)
216
+ elsif not(self.parent.nil?)
217
+ self.parent.data_system
218
+ else
219
+ Finitio::DEFAULT_SYSTEM
220
+ end
221
+ end
222
+
189
223
  # Duplicates this configuration and yields the block with the new one,
190
224
  # if a block is given.
191
225
  #
@@ -13,13 +13,7 @@ module Webspicy
13
13
  # Yields each resource file in the current scope
14
14
  def each_resource_file(&bl)
15
15
  return enum_for(:each_resource_file) unless block_given?
16
- if config.has_children?
17
- config.children.each do |child|
18
- _each_resource_file(child, &bl)
19
- end
20
- else
21
- _each_resource_file(config, &bl)
22
- end
16
+ _each_resource_file(config, &bl)
23
17
  end
24
18
 
25
19
  # Recursive implementation of `each_resource_file` for each
@@ -65,10 +59,7 @@ module Webspicy
65
59
 
66
60
  # Returns the Data system to use for parsing schemas
67
61
  def data_system
68
- @data_system ||= begin
69
- schema = config.folder/"schema.fio"
70
- schema.file? ? Finitio::DEFAULT_SYSTEM.parse(schema.read) : Finitio::DEFAULT_SYSTEM
71
- end
62
+ @data_system ||= config.data_system
72
63
  end
73
64
 
74
65
 
@@ -7,7 +7,7 @@ module Webspicy
7
7
  attr_reader :config
8
8
 
9
9
  def call
10
- Webspicy.with_scope_for(config) do |scope|
10
+ config.each_scope do |scope|
11
11
  client = scope.get_client
12
12
  scope.each_resource do |resource|
13
13
  scope.each_service(resource) do |service|
@@ -2,7 +2,7 @@ module Webspicy
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = "0-rc1"
5
+ TINY = "0-rc2"
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.3.0.pre.rc1
4
+ version: 0.3.0.pre.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau