Skip to content

Commit

Permalink
Fix workflow status when the workflow is pending to start (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahfpf authored Aug 8, 2024
1 parent aa0a8a1 commit f06f85f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/gush/workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def status
when stopped?
:stopped
else
:running
:pending
end
end

Expand Down
24 changes: 23 additions & 1 deletion spec/gush/workflow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,28 @@ def configure(*args)
end
end

describe "#status" do
it "returns failed" do
subject.find_job('Prepare').fail!
expect(subject.status).to eq(:failed)
end
it "returns running" do
subject.find_job('Prepare').start!
expect(subject.status).to eq(:running)
end
it "returns finished" do
subject.jobs.each {|n| n.finish! }
expect(subject.status).to eq(:finished)
end
it "returns stopped" do
subject.stopped = true
expect(subject.status).to eq(:stopped)
end
it "returns pending" do
expect(subject.status).to eq(:pending)
end
end

describe "#to_json" do
it "returns correct hash" do
klass = Class.new(Gush::Workflow) do
Expand All @@ -145,7 +167,7 @@ def configure(*args)
"id" => an_instance_of(String),
"name" => klass.to_s,
"klass" => klass.to_s,
"status" => "running",
"status" => "pending",
"total" => 2,
"finished" => 0,
"started_at" => nil,
Expand Down

0 comments on commit f06f85f

Please sign in to comment.