|
@@ -51,7 +51,7 @@ class Api::V1::TasksControllerTest < ActionDispatch::IntegrationTest
|
51
|
51
|
assert_response :created
|
52
|
52
|
end
|
53
|
53
|
|
54
|
|
- test "should forbid create task" do
|
|
54
|
+ test "should not create task" do
|
55
|
55
|
assert_no_difference("Task.count") do
|
56
|
56
|
post api_v1_activity_tasks_url(@activity),
|
57
|
57
|
params: { task: { name: @task.name, description: @task.description, user_id: @user, activity_id: @activity } },
|
|
@@ -59,4 +59,20 @@ class Api::V1::TasksControllerTest < ActionDispatch::IntegrationTest
|
59
|
59
|
end
|
60
|
60
|
assert_response :forbidden
|
61
|
61
|
end
|
|
62
|
+
|
|
63
|
+ # UPDATE
|
|
64
|
+ test "should update task" do
|
|
65
|
+ patch api_v1_activity_task_url(@activity, @task),
|
|
66
|
+ params: { task: { name: "New name", description: "New description" } },
|
|
67
|
+ headers: { Authorization: JsonWebToken.encode(user_id: @user.id) },
|
|
68
|
+ as: :json
|
|
69
|
+ assert_response :success
|
|
70
|
+ end
|
|
71
|
+
|
|
72
|
+ test "should not update task" do
|
|
73
|
+ patch api_v1_activity_task_url(@activity, @task),
|
|
74
|
+ params: { task: { name: "New name", description: "New description" } },
|
|
75
|
+ as: :json
|
|
76
|
+ assert_response :forbidden
|
|
77
|
+ end
|
62
|
78
|
end
|