|
@@ -75,4 +75,22 @@ class Api::V1::TasksControllerTest < ActionDispatch::IntegrationTest
|
75
|
75
|
as: :json
|
76
|
76
|
assert_response :forbidden
|
77
|
77
|
end
|
|
78
|
+
|
|
79
|
+ # DESTROY
|
|
80
|
+ test "should destroy task" do
|
|
81
|
+ assert_difference "Task.count", -1 do
|
|
82
|
+ delete api_v1_activity_task_url(@activity, @task),
|
|
83
|
+ headers: { Authorization: JsonWebToken.encode(user_id: @user.id) },
|
|
84
|
+ as: :json
|
|
85
|
+ end
|
|
86
|
+ assert_response :no_content
|
|
87
|
+ end
|
|
88
|
+
|
|
89
|
+ test "should not destroy task" do
|
|
90
|
+ assert_no_difference('Task.count') do
|
|
91
|
+ delete api_v1_activity_task_url(@activity, @task),
|
|
92
|
+ as: :json
|
|
93
|
+ end
|
|
94
|
+ assert_response :forbidden
|
|
95
|
+ end
|
78
|
96
|
end
|