|
@@ -68,15 +68,7 @@ class Api::V1::ActivitiesControllerTest < ActionDispatch::IntegrationTest
|
68
|
68
|
as: :json
|
69
|
69
|
assert_response :forbidden
|
70
|
70
|
end
|
71
|
|
-
|
72
|
|
- test "should forbid update activity - not owner or admin" do
|
73
|
|
- patch api_v1_activity_url(@activity),
|
74
|
|
- params: { activity: { name: "Updated name" } },
|
75
|
|
- headers: { Authorization: JsonWebToken.encode(user_id: users(:two).id) },
|
76
|
|
- as: :json
|
77
|
|
- assert_response :forbidden
|
78
|
|
- end
|
79
|
|
-
|
|
71
|
+
|
80
|
72
|
#DESTROY
|
81
|
73
|
test "should destroy activity" do
|
82
|
74
|
assert_difference "Activity.count", -1 do
|
|
@@ -93,13 +85,4 @@ class Api::V1::ActivitiesControllerTest < ActionDispatch::IntegrationTest
|
93
|
85
|
end
|
94
|
86
|
assert_response :forbidden
|
95
|
87
|
end
|
96
|
|
-
|
97
|
|
- test "should forbid destroy activity - not owner or admin" do
|
98
|
|
- assert_no_difference('Activity.count') do
|
99
|
|
- delete api_v1_activity_url(@activity),
|
100
|
|
- headers: { Authorization: JsonWebToken.encode(user_id: users(:two).id) },
|
101
|
|
- as: :json
|
102
|
|
- end
|
103
|
|
- assert_response :forbidden
|
104
|
|
- end
|
105
|
88
|
end
|