Skip to content

Commit

Permalink
Added missing policy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsidhu85 committed Jan 14, 2025
1 parent 86fe26a commit 10d06e2
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/policies/workflow_execution_policy_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,38 @@ def setup
assert_not policy.apply(:create?)
end

test 'update?' do
assert @policy.apply(:update?)

user = users(:james_doe)
workflow_execution = workflow_executions(:automated_workflow_execution)
policy = WorkflowExecutionPolicy.new(workflow_execution, user: user)

assert policy.apply(:update?)

user = users(:ryan_doe)
workflow_execution = workflow_executions(:automated_workflow_execution)
policy = WorkflowExecutionPolicy.new(workflow_execution, user: user)

assert_not policy.apply(:update?)
end

test 'edit?' do
assert @policy.apply(:edit?)

user = users(:james_doe)
workflow_execution = workflow_executions(:automated_workflow_execution)
policy = WorkflowExecutionPolicy.new(workflow_execution, user: user)

assert policy.apply(:edit?)

user = users(:ryan_doe)
workflow_execution = workflow_executions(:automated_workflow_execution)
policy = WorkflowExecutionPolicy.new(workflow_execution, user: user)

assert_not policy.apply(:edit?)
end

test '#cancel?' do
assert @policy.apply(:cancel?)

Expand Down

0 comments on commit 10d06e2

Please sign in to comment.