Add destroy def and unit test
This commit is contained in:
parent
da5edf8eab
commit
fc38057172
3 changed files with 25 additions and 1 deletions
|
|
@ -75,4 +75,22 @@ class Api::V1::TasksControllerTest < ActionDispatch::IntegrationTest
|
|||
as: :json
|
||||
assert_response :forbidden
|
||||
end
|
||||
|
||||
# DESTROY
|
||||
test "should destroy task" do
|
||||
assert_difference "Task.count", -1 do
|
||||
delete api_v1_activity_task_url(@activity, @task),
|
||||
headers: { Authorization: JsonWebToken.encode(user_id: @user.id) },
|
||||
as: :json
|
||||
end
|
||||
assert_response :no_content
|
||||
end
|
||||
|
||||
test "should not destroy task" do
|
||||
assert_no_difference('Task.count') do
|
||||
delete api_v1_activity_task_url(@activity, @task),
|
||||
as: :json
|
||||
end
|
||||
assert_response :forbidden
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue