webspicy 0.20.24 → 0.21.0

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: 358d398af31550346d16e0b0aea1fbdbbdb6d9b6097adc0f53642faf73605447
4
- data.tar.gz: 73bbb61d76edb81151a2d201b51a8e509d79728145a524f04a33bb80696ced46
3
+ metadata.gz: 297aab67c7235a6a0100db0b857b15d7897beeaa58aa8a8572b4b13df5ccba28
4
+ data.tar.gz: a5694c1b122ed3c135790b04e837d88be9baad28c2b5b8cb594311339dc89c34
5
5
  SHA512:
6
- metadata.gz: 641ccd34d62b106ac983ed192fb54f313dfd03a1a068a95018e84fdb840a0e54dfa3d410617a2fb357519eebd344e3f179e7cdac0cc7ae61b43b51a770f32284
7
- data.tar.gz: f9ed1ae27dbaae00369437622f04610391225ce39c19636e430cb5e10f1606a52b50582aa01a83a611aee61aab673a4eb67f94d340f21906924409020713f886
6
+ metadata.gz: 6c68dfdb65de4636f3cbc85703f6224e7ff7bcf9edd77cdf92aa67de47fd7086ceb2b1c4b91317a944f0acd618c03c8caa9c3f2c5e76f004b4e0fe779adc7085
7
+ data.tar.gz: 994aa8228e557a3baef8612653dc5d6d30377b2c405eb6f35508acd0c953865d23bd2da0f73be5492ea70c538fdb9ba2ef3fcc4f0f1253e7b6ee9cce2ea8e35a
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Test](https://github.com/enspirit/webspicy/actions/workflows/integration.yml/badge.svg?branch=master)](https://github.com/enspirit/webspicy/actions/workflows/integration.yml)
1
+ [![Test](https://github.com/enspirit/webspicy/actions/workflows/integration.yml/badge.svg)](https://github.com/enspirit/webspicy/actions/workflows/integration.yml/badge.svg)
2
2
  # Webspicy
3
3
 
4
4
  A specification and test framework for web services seen as black-box software
data/bin/webspicy CHANGED
@@ -21,6 +21,7 @@
21
21
  #/ - TAG=... execute only tests matching the given tag
22
22
  #/ - FAILFAST=yes|no stop executing tests on first failure
23
23
  #/ - INSECURE=yes|no allow insecure server connections when using SSL
24
+ #/ - WATCH=FOLDER,FOLDER,... run in watch mode (run tests when files change)
24
25
  #/
25
26
  require 'webspicy'
26
27
  require 'webspicy/tester'
@@ -42,6 +43,9 @@ ARGV.options do |opts|
42
43
  opts.on('-k', '--insecure') {
43
44
  ENV['INSECURE'] = 'yes'
44
45
  }
46
+ opts.on('-w', '--watch') {
47
+ ENV['WATCH'] = '.'
48
+ }
45
49
  opts.on("--debug") {
46
50
  ENV['LOG_LEVEL'] = 'DEBUG'
47
51
  Webspicy::LOGGER.level = Logger.const_get(ENV['LOG_LEVEL'])
@@ -43,6 +43,7 @@ module Webspicy
43
43
  @scope_factory = ->(config){ Scope.new(config) }
44
44
  @client = Web::HttpClient
45
45
  @reporter = default_reporter
46
+ @watch_list = default_watchlist
46
47
  Path.require_tree(@folder/'support') if (@folder/'support').exists?
47
48
  @world = Support::World.new(folder/'world', self)
48
49
  yield(self) if block_given?
@@ -451,6 +452,13 @@ module Webspicy
451
452
  end
452
453
  attr_accessor :reporter
453
454
 
455
+ def default_watchlist
456
+ return nil unless list = ENV['WATCH']
457
+
458
+ list.split(',').map{|x| Path.pwd/x }
459
+ end
460
+ attr_accessor :watch_list
461
+
454
462
  # Returns the Data system to use for parsing schemas
455
463
  #
456
464
  # The data system associated with a configuration is build when the
@@ -10,7 +10,7 @@ module Webspicy
10
10
  @reporter << Reporter::SuccessOrNot.new
11
11
  end
12
12
 
13
- def run_scope
13
+ def run_scope(all = true)
14
14
  scope.each_specification_file do |spec_file|
15
15
  @specification = load_specification(spec_file)
16
16
  reporter.spec_file_done
@@ -6,8 +6,7 @@ module Webspicy
6
6
 
7
7
  def initialize(*args, &bl)
8
8
  super
9
- @spec_file_errors = []
10
- @failed_results = []
9
+ clear
11
10
  end
12
11
  attr_reader :failed_results, :spec_file_errors
13
12
 
@@ -24,6 +23,11 @@ module Webspicy
24
23
  report_failed_results
25
24
  end
26
25
 
26
+ def clear
27
+ @spec_file_errors = []
28
+ @failed_results = []
29
+ end
30
+
27
31
  private
28
32
 
29
33
  def report_spec_file_errors
@@ -5,8 +5,7 @@ module Webspicy
5
5
 
6
6
  def initialize(*args, &bl)
7
7
  super
8
- @spec_files_count = 0
9
- @errors_count = 0
8
+ clear
10
9
  end
11
10
  attr_reader :spec_files_count, :errors_count
12
11
 
@@ -31,6 +30,11 @@ module Webspicy
31
30
  io.flush
32
31
  end
33
32
 
33
+ def clear
34
+ @spec_files_count = 0
35
+ @errors_count = 0
36
+ end
37
+
34
38
  private
35
39
 
36
40
  def success?
@@ -5,14 +5,7 @@ module Webspicy
5
5
 
6
6
  def initialize(*args, &bl)
7
7
  super
8
- @spec_files_count = 0
9
- @examples_count = 0
10
- @counterexamples_count = 0
11
- @assertions_count = 0
12
- #
13
- @spec_file_errors_count = 0
14
- @errors_count = 0
15
- @failures_count = 0
8
+ clear
16
9
  end
17
10
  attr_reader :spec_files_count, :examples_count, :counterexamples_count
18
11
  attr_reader :assertions_count
@@ -54,6 +47,17 @@ module Webspicy
54
47
  io.flush
55
48
  end
56
49
 
50
+ def clear
51
+ @spec_files_count = 0
52
+ @examples_count = 0
53
+ @counterexamples_count = 0
54
+ @assertions_count = 0
55
+ #
56
+ @spec_file_errors_count = 0
57
+ @errors_count = 0
58
+ @failures_count = 0
59
+ end
60
+
57
61
  def total_error_count
58
62
  @spec_file_errors_count + @errors_count + @failures_count
59
63
  end
@@ -58,7 +58,8 @@ module Webspicy
58
58
  :after_each_done,
59
59
  :after_all,
60
60
  :after_all_done,
61
- :report
61
+ :report,
62
+ :clear
62
63
  ]
63
64
 
64
65
  HOOKS.each do |meth|
@@ -32,9 +32,23 @@ module Webspicy
32
32
  end
33
33
 
34
34
  def call
35
+ res = call_once(true)
36
+ if folders = config.watch_list
37
+ require 'listen'
38
+ listener = Listen.to(*folders) do
39
+ reporter.clear
40
+ res = call_once(false)
41
+ end
42
+ listener.start
43
+ sleep
44
+ end
45
+ res
46
+ end
47
+
48
+ def call_once(all = true)
35
49
  reporter.init(self)
36
50
  begin
37
- run_config
51
+ run_config(all)
38
52
  rescue FailFast
39
53
  end
40
54
  reporter.report
@@ -64,19 +78,21 @@ module Webspicy
64
78
 
65
79
  protected
66
80
 
67
- def run_config
81
+ def run_config(all = true)
68
82
  config.each_scope do |scope|
69
83
  @scope = scope
70
84
  @hooks = Support::Hooks.for(scope.config)
71
85
  @client = scope.get_client
72
- run_scope
86
+ run_scope(all)
73
87
  end
74
88
  end
75
89
 
76
- def run_scope
77
- reporter.before_all
78
- hooks.fire_before_all(self)
79
- reporter.before_all_done
90
+ def run_scope(all = true)
91
+ if all
92
+ reporter.before_all
93
+ hooks.fire_before_all(self)
94
+ reporter.before_all_done
95
+ end
80
96
  reporter.before_scope
81
97
  scope.each_specification_file do |spec_file|
82
98
  @specification = load_specification(spec_file)
@@ -90,9 +106,11 @@ module Webspicy
90
106
  end
91
107
  end
92
108
  reporter.scope_done
93
- reporter.after_all
94
- hooks.fire_after_all(self)
95
- reporter.after_all_done
109
+ if all
110
+ reporter.after_all
111
+ hooks.fire_after_all(self)
112
+ reporter.after_all_done
113
+ end
96
114
  end
97
115
 
98
116
  def load_specification(spec_file)
@@ -1,8 +1,8 @@
1
1
  module Webspicy
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 20
5
- TINY = 24
4
+ MINOR = 21
5
+ TINY = 0
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -184,6 +184,35 @@ module Webspicy
184
184
  end
185
185
  end
186
186
 
187
+ describe 'watch_list' do
188
+
189
+ it 'is nil by default' do
190
+ config = Configuration.new
191
+ expect(config.watch_list).to be_nil
192
+ end
193
+
194
+ it 'supports a single relative folder on WATCH env variable' do
195
+ ENV['WATCH'] = 'a_folder'
196
+ config = Configuration.new
197
+ expect(config.watch_list).to eql([Path.pwd/"a_folder"])
198
+ ENV.delete('WATCH')
199
+ end
200
+
201
+ it 'supports a commalist on WATCH env variable' do
202
+ ENV['WATCH'] = 'a_folder,another'
203
+ config = Configuration.new
204
+ expect(config.watch_list).to eql([Path.pwd/"a_folder", Path.pwd/'another'])
205
+ ENV.delete('WATCH')
206
+ end
207
+
208
+ it 'supports absolute folders too' do
209
+ ENV['WATCH'] = 'a_folder,/tmp'
210
+ config = Configuration.new
211
+ expect(config.watch_list).to eql([Path.pwd/"a_folder", Path('/tmp')])
212
+ ENV.delete('WATCH')
213
+ end
214
+ end
215
+
187
216
  describe 'insecure' do
188
217
 
189
218
  it 'is false by default' do
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.24
4
+ version: 0.21.0
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-12-23 00:00:00.000000000 Z
11
+ date: 2022-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -246,6 +246,20 @@ dependencies:
246
246
  - - "~>"
247
247
  - !ruby/object:Gem::Version
248
248
  version: 0.7.0
249
+ - !ruby/object:Gem::Dependency
250
+ name: listen
251
+ requirement: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - "~>"
254
+ - !ruby/object:Gem::Version
255
+ version: '3.7'
256
+ type: :runtime
257
+ prerelease: false
258
+ version_requirements: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - "~>"
261
+ - !ruby/object:Gem::Version
262
+ version: '3.7'
249
263
  description: Webspicy helps testing web services as software operation black boxes
250
264
  email: blambeau@gmail.com
251
265
  executables:
@@ -394,7 +408,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
394
408
  - !ruby/object:Gem::Version
395
409
  version: '0'
396
410
  requirements: []
397
- rubygems_version: 3.2.32
411
+ rubygems_version: 3.3.7
398
412
  signing_key:
399
413
  specification_version: 4
400
414
  summary: Webspicy helps testing web services as software operation black boxes!