model: changement majeur des données de Task
This commit is contained in:
parent
2951a60800
commit
eb92b35d19
10 changed files with 35 additions and 23 deletions
|
|
@ -30,7 +30,7 @@ class Api::V1::TasksControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
json_response = JSON.parse(self.response.body)
|
||||
assert_equal @task.name, json_response['data']['attributes']['name']
|
||||
assert_equal @task.user_id, json_response['data']['attributes']['user_id']
|
||||
assert_equal @task.owner_id, json_response['data']['attributes']['owner_id']
|
||||
assert_equal @task.activity_id, json_response['data']['attributes']['activity_id']
|
||||
end
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ class Api::V1::TasksControllerTest < ActionDispatch::IntegrationTest
|
|||
test "should create task" do
|
||||
assert_difference("Task.count") do
|
||||
post api_v1_activity_tasks_url(@activity),
|
||||
params: { task: { name: @task.name, description: @task.description, user_id: @user, activity_id: @activity } },
|
||||
params: { task: { name: @task.name, description: @task.description, owner_id: @user, activity_id: @activity, start_time: DateTime.now } },
|
||||
headers: { Authorization: JsonWebToken.encode(user_id: @user.id) },
|
||||
as: :json
|
||||
end
|
||||
|
|
@ -54,7 +54,7 @@ class Api::V1::TasksControllerTest < ActionDispatch::IntegrationTest
|
|||
test "should not create task" do
|
||||
assert_no_difference("Task.count") do
|
||||
post api_v1_activity_tasks_url(@activity),
|
||||
params: { task: { name: @task.name, description: @task.description, user_id: @user, activity_id: @activity } },
|
||||
params: { task: { name: @task.name, description: @task.description, owner_id: @user, activity_id: @activity } },
|
||||
as: :json
|
||||
end
|
||||
assert_response :forbidden
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue