Skip to content

Commit

Permalink
Pass steps always set operation's success to true. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanrite authored Sep 7, 2023
1 parent ca05244 commit 24ac9ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/operational/operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 12 additions & 0 deletions spec/operational/operation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 24ac9ef

Please sign in to comment.