Skip to content

Commit

Permalink
Add state transitions for assessment
Browse files Browse the repository at this point in the history
  • Loading branch information
zacksiri committed Jul 1, 2024
1 parent c86f9c9 commit 354dd37
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
12 changes: 12 additions & 0 deletions lib/polar/machines/assessment/transitions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ defmodule Polar.Machines.Assessment.Transitions do
fn changes -> transit(changes) end
)

Assessment
|> transition(
[from: "failed", to: "running", via: "run"],
fn changes -> transit(changes) end
)

Assessment
|> transition(
[from: "running", to: "running", via: "run"],
fn changes -> transit(changes) end
)

Assessment
|> transition(
[from: "running", to: "passed", via: "pass"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ defmodule PolarWeb.Publish.Testing.AssessmentController do
assessment = Repo.preload(assessment, [:check])

conn
|> put_status(:created)
|> render(:create, %{assessment: assessment})
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ defmodule PolarWeb.Publish.Testing.AssessmentControllerTest do
}
})

assert %{"data" => data} = json_response(conn, 201)
assert %{"data" => data} = json_response(conn, 200)

assert %{"id" => _id, "current_state" => "created", "check" => _check} = data
end
Expand Down

0 comments on commit 354dd37

Please sign in to comment.