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 +4 -4
- data/examples/restful/Gemfile.lock +1 -1
- data/lib/webspicy/checker.rb +1 -1
- data/lib/webspicy/configuration.rb +35 -1
- data/lib/webspicy/scope.rb +2 -11
- data/lib/webspicy/tester.rb +1 -1
- data/lib/webspicy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d31b169f136144209e61a59ac7c7c848562e5646
|
4
|
+
data.tar.gz: 2e971cd2cf87bd7215039349257dbe6fe05d0a5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ac4e3b403070e46f7d85b88289cb81abc375422acf42164eab8ed70145201087bd5affb9fd94d54231f5ac388ee430ce9441f5959c9b372ebcfac2ce06a8bf4
|
7
|
+
data.tar.gz: f84f29c4023ef02e568b2c8b861a095f8ce118964ffb6cada0a3c3e1c9c6458d0ff5b4ed308e2a77edba6d64695bdb2492073c14977b3d871f72d38fbbfd7fae
|
data/lib/webspicy/checker.rb
CHANGED
@@ -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
|
#
|
data/lib/webspicy/scope.rb
CHANGED
@@ -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
|
-
|
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 ||=
|
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
|
|
data/lib/webspicy/tester.rb
CHANGED
data/lib/webspicy/version.rb
CHANGED