ruby_reactor 0.3.0 → 0.3.1

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: 863c83e92cbfab470e39107c580ceabce444133973b723662a89e5bf0211c3ab
4
- data.tar.gz: 1209b5587efc055bc787731694a6dc2b7eab8b3d5a6ff729728aa29ea601e2e0
3
+ metadata.gz: d3ddfd9b6e65d03e5c00d7980563da39b4132fc1d5f0dbe14e5b782d039c7f68
4
+ data.tar.gz: 785cc8ac8d426433a00f378eafb8f312b343950ecf496e2af0a6fe9e48115c29
5
5
  SHA512:
6
- metadata.gz: 146d14cd32b12c95764e493f2de2d826dbe074ec4e4b44613b788d748d52fe38644fd86f1590f6bb0b1a0d1840c2200ab29a6d8e78db27f8f6abf099faf74756
7
- data.tar.gz: 3d5b7c43182ee2d1c5c06ba90b7e2177a3dffbecdc8fb3e91db14f99bcd02807ebfa98c0e240412b790ec1d69609dc30995d9ee1aea9c8cb8ecd69d4d0fb2ac7
6
+ metadata.gz: 549a49deff5d63e129c0b4c043cbc3987dbbb09b054907a5acb8941af85fedb5f9706bad8d56948bbc7ea889eba19174254962ca987e7835b4cd0a7bf3f9e165
7
+ data.tar.gz: 319399c2854cccb505fc7e8f6c964eeeb527bad375ed513b1a2c2ea89b77445283f287bbff5a0892902a56a5a56b5a9aff105a0164006abf407473ad3780a58d
data/README.md CHANGED
@@ -5,16 +5,16 @@
5
5
 
6
6
  # RubyReactor
7
7
 
8
+ A dynamic, dependency-resolving saga orchestrator for Ruby. Ruby Reactor implements the Saga pattern with compensation-based error handling and DAG-based execution planning. It leverages **Sidekiq** for asynchronous execution and **Redis** for state persistence.
9
+
10
+ ![Payment workflow reactor](documentation/images/payment_workflow.png)
11
+
8
12
  ## Why Ruby Reactor?
9
13
 
10
14
  Building complex business transactions often results in spaghetti code or brittle "god classes." Ruby Reactor solves this by implementing the **Saga Pattern** in a lightweight, developer-friendly package. It lets you define workflows as clear, dependency-driven steps without the boilerplate of heavy enterprise frameworks.
11
15
 
12
16
  The key value is **Reliability**: if any part of your workflow fails, Ruby Reactor automatically triggers compensation logic to undo previous steps, ensuring your system never ends up in a corrupted half-state. Whether you're coordinating microservices or monolith modules, you get atomic-like consistency with background processing built-in.
13
17
 
14
- A dynamic, dependency-resolving saga orchestrator for Ruby. Ruby Reactor implements the Saga pattern with compensation-based error handling and DAG-based execution planning. It leverages **Sidekiq** for asynchronous execution and **Redis** for state persistence.
15
-
16
- ![Payment workflow reactor](documentation/images/payment_workflow.png)
17
-
18
18
  ## Features
19
19
 
20
20
  - **DAG-based Execution**: Steps are executed based on their dependencies, allowing for parallel execution of independent steps.
@@ -62,6 +62,7 @@ A dynamic, dependency-resolving saga orchestrator for Ruby. Ruby Reactor impleme
62
62
  - [Complex Workflows with Dependencies](#complex-workflows-with-dependencies)
63
63
  - [Error Handling and Compensation](#error-handling-and-compensation)
64
64
  - [Using Pre-defined Schemas](#using-pre-defined-schemas)
65
+ - [Testing](#testing)
65
66
  - [Documentation](#documentation)
66
67
  - [Future improvements](#future-improvements)
67
68
  - [Development](#development)
@@ -680,6 +681,29 @@ class SchemaValidatedReactor < RubyReactor::Reactor
680
681
  end
681
682
  ```
682
683
 
684
+ ### Testing
685
+
686
+ RubyReactor provides testing utilities for RSpec. See the [Testing with RSpec](documentation/testing.md) guide for comprehensive documentation.
687
+
688
+ ```ruby
689
+ RSpec.describe PaymentReactor do
690
+ it "processes payment successfully" do
691
+ subject = test_reactor(PaymentReactor, order_id: 123, amount: 99.99)
692
+
693
+ expect(subject).to be_success
694
+ expect(subject).to have_run_step(:charge_card).after(:validate_order)
695
+ expect(subject.step_result(:charge_card)).to include(status: "completed")
696
+ end
697
+
698
+ it "handles payment failures with mocked steps" do
699
+ subject = test_reactor(PaymentReactor, order_id: 123, amount: 99.99)
700
+ .mock_step(:charge_card) { Failure("Card declined") }
701
+
702
+ expect(subject).to be_failure
703
+ expect(subject.error).to include("Card declined")
704
+ end
705
+ end
706
+ ```
683
707
 
684
708
  ## Documentation
685
709
 
@@ -706,6 +730,9 @@ Configure robust retry policies for your steps. This guide details the available
706
730
  ### [Interrupts](documentation/interrupts.md)
707
731
  Learn how to pause and resume reactors to handle long-running processes, manual approvals, and asynchronous callbacks. Patterns for correlation IDs, timeouts, and payload validation.
708
732
 
733
+ ### [Testing with RSpec](documentation/testing.md)
734
+ Comprehensive guide to testing reactors with RubyReactor's testing utilities. Learn about the `TestSubject` class for reactor execution and introspection, step mocking for isolating dependencies, testing nested and composed reactors, and custom RSpec matchers like `be_success`, `have_run_step`, and `have_retried_step`.
735
+
709
736
  ### Examples
710
737
  - [Order Processing](documentation/examples/order_processing.md) - Complete order processing workflow example
711
738
  - [Payment Processing](documentation/examples/payment_processing.md) - Payment handling with compensation