chaotic_job 0.9.2 → 0.10.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: 875792232bd76377692ababa2471734fb8ca6770dc86cecbc5dd22ea94d4b570
4
- data.tar.gz: df305d86ce6dcb95ccf6960d193dc7cca203b669663ac1e594b463f784d46335
3
+ metadata.gz: fdea10dcc7bacf98d54e4281e1739576fe7512d305d4c431f0e0a143b7739c79
4
+ data.tar.gz: 98f16351090d9aae7bbf408fc81e392a9c9f7fb199c229866a89e56d03b3aaee
5
5
  SHA512:
6
- metadata.gz: b3fcbcab0ed164c21ddf065d6ba14105eeaf8bf2ab6ebeb1c3181e1dec226c19c3c150c8d140b2e78b1dedf8a4f5dbd5b9802a31f390bb7280af902f783e1ef7
7
- data.tar.gz: 22874eb33f98fa1329e1bb9eef276c1b1056b9e98636b3ac63b3e9f482e4fae31e68361fd5310d9648bf3977269d9fed1fb212c002e070f253cd69d8472f4d8f
6
+ metadata.gz: 7babde960cf8d244d49e3d7e6f3b486f8466df777e000d899f1e8bc41cd5044517efecbf21d825a20bbac73431e2d794813de5fda78c90fdeb03e8c15810570a
7
+ data.tar.gz: 5a1f7caf42a3293b1184e8c4ac5811a2e97d53d08fa81f3c886de3a50ca6827c4bcfd66d534d8e6fa77d0d42f97016aa52848c34cbfffda564b4e630bc1fd773
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.10.0] - 2025-06-18
4
+
5
+ - Run the assertions block within the scenario run to ensure the glitch is executed [#17](https://github.com/fractaledmind/chaotic_job/pull/17)
6
+ - Add a Switch class to allow tests to control a binary switch [#18](https://github.com/fractaledmind/chaotic_job/pull/18)
7
+
3
8
  ## [0.9.2] - 2025-06-17
4
9
 
5
10
  - Allow option to constrain which jobs are performed for a `Simulation` [#16](https://github.com/fractaledmind/chaotic_job/pull/16)
@@ -65,14 +65,19 @@ module ChaoticJob
65
65
  debug "👾 Running simulation with scenario: #{scenario}"
66
66
  @test.before_setup
67
67
  @test.simulation_scenario = scenario
68
+
68
69
  if @perform_only_jobs_within
69
- scenario.run { Performer.perform_all_before(@perform_only_jobs_within) }
70
+ scenario.run do
71
+ Performer.perform_all_before(@perform_only_jobs_within)
72
+ assertions.call(scenario)
73
+ end
70
74
  else
71
75
  scenario.run
76
+ assertions.call(scenario)
72
77
  end
78
+
73
79
  @test.after_teardown
74
80
  @test.assert scenario.glitched?, "Scenario did not execute glitch: #{scenario.glitch}"
75
- assertions.call(scenario)
76
81
  ensure
77
82
  @test.simulation_scenario = nil
78
83
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ChaoticJob
4
+ module Switch
5
+ extend self
6
+
7
+ def on?
8
+ @value ||= false
9
+ true == @value
10
+ end
11
+
12
+ def off?
13
+ @value ||= false
14
+ false == @value
15
+ end
16
+
17
+ def on!
18
+ @value = true
19
+ end
20
+
21
+ def off!
22
+ @value = false
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChaoticJob
4
- VERSION = "0.9.2"
4
+ VERSION = "0.10.0"
5
5
  end
data/lib/chaotic_job.rb CHANGED
@@ -7,6 +7,7 @@ require_relative "chaotic_job/tracer"
7
7
  require_relative "chaotic_job/glitch"
8
8
  require_relative "chaotic_job/scenario"
9
9
  require_relative "chaotic_job/simulation"
10
+ require_relative "chaotic_job/switch"
10
11
  require "set"
11
12
 
12
13
  module ChaoticJob
@@ -62,6 +63,10 @@ module ChaoticJob
62
63
  end
63
64
  end
64
65
 
66
+ def self.switch
67
+ Switch
68
+ end
69
+
65
70
  module Helpers
66
71
  attr_accessor :simulation_scenario
67
72
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chaotic_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Margheim
@@ -41,6 +41,7 @@ files:
41
41
  - lib/chaotic_job/performer.rb
42
42
  - lib/chaotic_job/scenario.rb
43
43
  - lib/chaotic_job/simulation.rb
44
+ - lib/chaotic_job/switch.rb
44
45
  - lib/chaotic_job/tracer.rb
45
46
  - lib/chaotic_job/version.rb
46
47
  - sig/chaotic_job.rbs