Adds some unit tests
This commit is contained in:
parent
02ca539cc8
commit
84d0b296fb
1 changed files with 7 additions and 0 deletions
|
|
@ -27,6 +27,12 @@ class Api::V1::RecordsControllerTest < ActionDispatch::IntegrationTest
|
|||
headers: { Authorization: JsonWebToken.encode(user_id: @record.user_id) },
|
||||
as: :json
|
||||
assert_response :success
|
||||
|
||||
json_response = JSON.parse(self.response.body)
|
||||
assert_equal @record.duration, json_response['data']['attributes']['duration']
|
||||
assert_equal @record.user_id, json_response['data']['attributes']['user_id']
|
||||
assert_equal @record.task_id, json_response['data']['attributes']['task_id']
|
||||
assert_equal @record.is_handled, json_response['data']['attributes']['is_handled']
|
||||
end
|
||||
|
||||
test "should not access show" do
|
||||
|
|
@ -34,4 +40,5 @@ class Api::V1::RecordsControllerTest < ActionDispatch::IntegrationTest
|
|||
as: :json
|
||||
assert_response :forbidden
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue