Skip to content

Commit 137a234

Browse files
Proposition: the dig did not work on my machine (#78)
* Proposition: the dig did not work on my machine The dig solution did not work on my machine, but I am not sure why (quite new with ruby and rails). the solution with brackets wroks, so maybe we can change that, But any explanation is really welcomed 😄 * Use symbolize_names instead of changing to dic Co-authored-by: Alexandre Rousseau <[email protected]> * reuse dig instead of dict * Update chapter09-optimization.adoc Co-authored-by: Alexandre Rousseau <[email protected]>
1 parent 26c0e3b commit 137a234

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rails6/fr/chapter09-optimization.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ class Api::V1::OrdersControllerTest < ActionDispatch::IntegrationTest
201201
get api_v1_orders_url, headers: { Authorization: JsonWebToken.encode(user_id: @order.user_id) }, as: :json
202202
assert_response :success
203203
204-
json_response = JSON.parse(response.body)
205-
assert_equal @order.user.orders.count, json_response['data'].count
204+
json_response = JSON.parse(response.body, symbolize_names: true)
205+
assert_equal @order.user.orders.count, json_response[:data].count
206206
assert_not_nil json_response.dig(:links, :first)
207207
assert_not_nil json_response.dig(:links, :last)
208208
assert_not_nil json_response.dig(:links, :prev)

0 commit comments

Comments
 (0)