test_bench 1.1.0.0 → 1.2.0.0

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: 9d18b019b73d853e50b78abd989c8d8969c65eb7c5beedc0f3eeadb415f652aa
4
- data.tar.gz: e8a421026be5f2cf1c5f2af81ddd6a763ab0095669bbda97998fee4ca6fafb83
3
+ metadata.gz: afaeab0cc192ef871046e2b2080e87f9ae413a0da8a55e2893e240f76369c87e
4
+ data.tar.gz: 9cca5db44320b3956cbb8754251703087024411d274e608a2d731ce6c7a2729d
5
5
  SHA512:
6
- metadata.gz: bc855a5819e98378bae988487b7d8e55c5143ca157f6f116c1411e2bbf087771a6bf992650049d07cb3b1a8a0666ad56ef4ef05686a88536264884700851de77
7
- data.tar.gz: 15a6baea7cbbf7f8cfcccaa17c3bb128fe396be9ffb227087335f4edc5a569d95cdbe066359f9af80907f3fa298e8299af8be0d402fb6e08c3c125222fe69a23
6
+ metadata.gz: 80da06a441f1f3a547a62ee37fbf36f1d6c1c9541bd240c82fc94d7d380da1f6ddf717d6a626c5f50161488dfe4178057e14c59183ad751660bf8627fc322db4
7
+ data.tar.gz: 42d0355bb4f6c81a1819da5cfffa1fd41ece43b1f1a2e14600e5f52a9ef53f11a10309c792862bef9557bfe62a5e44a644883dda4b427b362fd813f8c2361c0b
@@ -62,7 +62,7 @@ module TestBench
62
62
  parser.separator('')
63
63
  parser.separator("Configuration Options")
64
64
 
65
- parser.on('-a', '--[no-]abort-on-error', %{Exit immediately after any test failure or error (Default: #{Session::Defaults.abort_on_error ? 'on' : 'off'})}) do |abort_on_error|
65
+ parser.on('-a', '--[no-]abort-on-error', %{Exit immediately after any test failure or error (Default: #{TestBench::Defaults.abort_on_error ? 'on' : 'off'})}) do |abort_on_error|
66
66
  env['TEST_BENCH_ABORT_ON_ERROR'] = abort_on_error ? 'on' : 'off'
67
67
  end
68
68
 
@@ -116,7 +116,7 @@ module TestBench
116
116
  env['TEST_BENCH_OUTPUT_STYLING'] = styling_text
117
117
  end
118
118
 
119
- parser.on('-p', '--[no-]permit-deactivated-tests', %{Do not fail the test run if there are deactivated tests or contexts, e.g. _test or _context (Default: #{!DeactivationVariants::Defaults.fail_session ? 'on' : 'off'})}) do |permit_deactivated_tests|
119
+ parser.on('-p', '--[no-]permit-deactivated-tests', %{Do not fail the test run if there are deactivated tests or contexts, e.g. _test or _context (Default: #{!TestBench::Defaults.fail_deactivated_tests ? 'on' : 'off'})}) do |permit_deactivated_tests|
120
120
  env['TEST_BENCH_FAIL_DEACTIVATED_TESTS'] = !permit_deactivated_tests ? 'on' : 'off'
121
121
  end
122
122
 
@@ -1,21 +1,11 @@
1
1
  module TestBench
2
2
  module DeactivationVariants
3
3
  def _context(title=nil, &block)
4
- test_session.fail! if Defaults.fail_session
5
-
6
4
  context(title)
7
5
  end
8
6
 
9
7
  def _test(title=nil, &block)
10
- test_session.fail! if Defaults.fail_session
11
-
12
8
  test(title)
13
9
  end
14
-
15
- module Defaults
16
- def self.fail_session
17
- Environment::Boolean.fetch('TEST_BENCH_FAIL_DEACTIVATED_TESTS', true)
18
- end
19
- end
20
10
  end
21
11
  end
@@ -3,7 +3,7 @@ module TestBench
3
3
  Error = Class.new(RuntimeError)
4
4
 
5
5
  def session
6
- @session ||= Session::Substitute.build
6
+ @session ||= Fixture::Session::Substitute.build
7
7
  end
8
8
  attr_writer :session
9
9
 
@@ -25,7 +25,7 @@ module TestBench
25
25
 
26
26
  instance.exclude_pattern = exclude unless exclude.nil?
27
27
 
28
- Session.configure(instance, session: session)
28
+ Fixture::Session.configure(instance, session: session)
29
29
  instance.session.output = output unless output.nil?
30
30
 
31
31
  instance
@@ -2,7 +2,9 @@ module TestBench
2
2
  def self.session
3
3
  @session ||= build_session.tap do |session|
4
4
  at_exit do
5
- exit 1 if session.failed?
5
+ exit_code = exit_code(session)
6
+
7
+ exit(exit_code) unless exit_code.zero?
6
8
  end
7
9
  end
8
10
  end
@@ -65,7 +67,7 @@ module TestBench
65
67
  end
66
68
 
67
69
  def self.session_error_policy(abort_on_error=nil)
68
- abort_on_error = Session::Defaults.abort_on_error if abort_on_error.nil?
70
+ abort_on_error = Defaults.abort_on_error if abort_on_error.nil?
69
71
 
70
72
  if abort_on_error
71
73
  :abort
@@ -74,11 +76,29 @@ module TestBench
74
76
  end
75
77
  end
76
78
 
79
+ def self.exit_code(session, fail_deactivated_tests: nil)
80
+ if fail_deactivated_tests.nil?
81
+ fail_deactivated_tests = Defaults.fail_deactivated_tests
82
+ end
83
+
84
+ if session.failed?
85
+ 1
86
+ elsif session.skip?
87
+ fail_deactivated_tests ? 2 : 0
88
+ else
89
+ 0
90
+ end
91
+ end
92
+
77
93
  Session = Fixture::Session
78
94
 
79
- module Session::Defaults
95
+ module Defaults
80
96
  def self.abort_on_error
81
97
  Environment::Boolean.fetch('TEST_BENCH_ABORT_ON_ERROR', false)
82
98
  end
99
+
100
+ def self.fail_deactivated_tests
101
+ Environment::Boolean.fetch('TEST_BENCH_FAIL_DEACTIVATED_TESTS', true)
102
+ end
83
103
  end
84
104
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_bench
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.0
4
+ version: 1.2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Ladd
8
8
  autorequire:
9
9
  bindir: script
10
10
  cert_chain: []
11
- date: 2020-07-23 00:00:00.000000000 Z
11
+ date: 2020-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test_bench-fixture
@@ -72,8 +72,6 @@ files:
72
72
  - lib/test_bench/controls/time.rb
73
73
  - lib/test_bench/deactivation_variants.rb
74
74
  - lib/test_bench/environment/boolean.rb
75
- - lib/test_bench/fixture
76
- - lib/test_bench/fixture.rb
77
75
  - lib/test_bench/fixtures.rb
78
76
  - lib/test_bench/fixtures/configure_receiver.rb
79
77
  - lib/test_bench/output.rb
@@ -1 +0,0 @@
1
- lib/test_bench/home/ntl/Projects/test-bench-fixture/lib/test_bench/fixture
@@ -1 +0,0 @@
1
- lib/test_bench/home/ntl/Projects/test-bench-fixture/lib/test_bench/fixture.rb