assert 2.19.3 → 2.19.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assert/config.rb +13 -1
- data/lib/assert/version.rb +1 -1
- data/test/unit/config_tests.rb +24 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffa19cd67672156c36573b10b2e25b2b18ffa6b291b763ee25aca8a36d10b5bb
|
4
|
+
data.tar.gz: 12ed7729dae14a838f02780ba66da65cd097a705d6746ce898525c9cffd5a7b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6be9346bf38ff9421f5663a18f4f3d2c020aa970245364db4df78100851feedaefae17fd2bc14bf21a2dc9d668efa5372fb1432402a587b6d79723e15e45179
|
7
|
+
data.tar.gz: 69b152a7ec1f5fcbf738246477d7d8085aae7805e064536f3134e7b4aca0c2d22f0f4ea03c65e78488ba426c1db0b05c1b74adafd979f73f23d7c78349293667
|
data/lib/assert/config.rb
CHANGED
@@ -41,7 +41,7 @@ module Assert
|
|
41
41
|
@run_diff_proc = Assert::U.syscmd_diff_proc
|
42
42
|
|
43
43
|
# option settings
|
44
|
-
@runner_seed =
|
44
|
+
@runner_seed = (env_runner_seed || random_runner_seed).to_i
|
45
45
|
@changed_only = false
|
46
46
|
@changed_ref = ""
|
47
47
|
@single_test = ""
|
@@ -78,5 +78,17 @@ module Assert
|
|
78
78
|
def single_test_file_path
|
79
79
|
single_test_file_line&.file
|
80
80
|
end
|
81
|
+
|
82
|
+
def env_runner_seed
|
83
|
+
ENV["SEED"]
|
84
|
+
end
|
85
|
+
|
86
|
+
def random_runner_seed
|
87
|
+
@random_runner_seed ||=
|
88
|
+
begin
|
89
|
+
srand
|
90
|
+
srand % 0xFFFF
|
91
|
+
end
|
92
|
+
end
|
81
93
|
end
|
82
94
|
end
|
data/lib/assert/version.rb
CHANGED
data/test/unit/config_tests.rb
CHANGED
@@ -29,6 +29,7 @@ class Assert::Config
|
|
29
29
|
should have_imeths :verbose, :list, :debug
|
30
30
|
should have_imeths :apply, :single_test?
|
31
31
|
should have_imeths :single_test_file_line, :single_test_file_path
|
32
|
+
should have_imeths :env_runner_seed, :random_runner_seed
|
32
33
|
|
33
34
|
should "default the view, suite, and runner" do
|
34
35
|
assert_that(subject.view).is_kind_of(Assert::DefaultView)
|
@@ -63,6 +64,29 @@ class Assert::Config
|
|
63
64
|
assert_that(subject.debug).is_false
|
64
65
|
end
|
65
66
|
|
67
|
+
should "prefer a SEED env var, if present, for the runner seed value" do
|
68
|
+
orig_env_seed = ENV["SEED"]
|
69
|
+
new_env_seed = Factory.integer
|
70
|
+
ENV["SEED"] = new_env_seed.to_s
|
71
|
+
|
72
|
+
config = unit_class.new
|
73
|
+
assert_that(config.env_runner_seed).equals(new_env_seed.to_s)
|
74
|
+
assert_that(config.runner_seed).equals(config.env_runner_seed.to_i)
|
75
|
+
|
76
|
+
ENV["SEED"] = orig_env_seed
|
77
|
+
end
|
78
|
+
|
79
|
+
should "fallback to a random runner seed value if no SEED env var" do
|
80
|
+
orig_env_seed = ENV["SEED"]
|
81
|
+
ENV["SEED"] = nil
|
82
|
+
|
83
|
+
config = unit_class.new
|
84
|
+
assert_that(config.random_runner_seed).is_not_nil
|
85
|
+
assert_that(config.runner_seed).equals(config.random_runner_seed.to_i)
|
86
|
+
|
87
|
+
ENV["SEED"] = orig_env_seed
|
88
|
+
end
|
89
|
+
|
66
90
|
should "apply settings given from a hash" do
|
67
91
|
assert subject.halt_on_fail
|
68
92
|
subject.apply(halt_on_fail: false)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.19.
|
4
|
+
version: 2.19.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-01-
|
12
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: much-style-guide
|