From 24ac9ef24f85414517c00d67eb34d909d7bedf98 Mon Sep 17 00:00:00 2001 From: Bryan Rite Date: Thu, 7 Sep 2023 13:48:38 -0700 Subject: [PATCH] Pass steps always set operation's success to true. (#3) --- lib/operational/operation.rb | 1 + spec/operational/operation_spec.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/operational/operation.rb b/lib/operational/operation.rb index 1e85b5c..2cb40f2 100644 --- a/lib/operational/operation.rb +++ b/lib/operational/operation.rb @@ -34,6 +34,7 @@ def self.call(state={}) raise UnknownStepType end + result = true if type == :pass instance.instance_variable_set(:@_operational_succeeded, result ? true : false) instance.instance_variable_get(:@_operational_path) << (result ? true : false) diff --git a/spec/operational/operation_spec.rb b/spec/operational/operation_spec.rb index 7d0190d..94ac72d 100644 --- a/spec/operational/operation_spec.rb +++ b/spec/operational/operation_spec.rb @@ -175,5 +175,17 @@ def step3(state) it "sets the result boolean" do expect(OpClass.call.succeeded?).to eq true end + + context "when ending in a pass step" do + let(:op_class) do + Class.new(described_class) do + pass ->(state) { state[:track] = [1]; false } + end + end + + it "sets succeeded as true" do + expect(OpClass.call.succeeded?).to eq true + end + end end end