Bläddra i källkod

Adds some unit tests

Lou 3 år sedan
förälder
incheckning
84d0b296fb
1 ändrade filer med 7 tillägg och 0 borttagningar
  1. 7
    0
      test/controllers/api/v1/records_controller_test.rb

+ 7
- 0
test/controllers/api/v1/records_controller_test.rb Visa fil

@@ -27,6 +27,12 @@ class Api::V1::RecordsControllerTest < ActionDispatch::IntegrationTest
27 27
     headers: { Authorization: JsonWebToken.encode(user_id: @record.user_id) },
28 28
     as: :json
29 29
     assert_response :success
30
+
31
+    json_response = JSON.parse(self.response.body)
32
+    assert_equal @record.duration, json_response['data']['attributes']['duration']
33
+    assert_equal @record.user_id, json_response['data']['attributes']['user_id']
34
+    assert_equal @record.task_id, json_response['data']['attributes']['task_id']
35
+    assert_equal @record.is_handled, json_response['data']['attributes']['is_handled']
30 36
   end
31 37
 
32 38
   test "should not access show" do
@@ -34,4 +40,5 @@ class Api::V1::RecordsControllerTest < ActionDispatch::IntegrationTest
34 40
     as: :json
35 41
     assert_response :forbidden
36 42
   end
43
+
37 44
 end

Loading…
Avbryt
Spara