Chapter 3: Build users - namespace nesting in book different from my generated code
notapatch opened this issue · 2 comments
notapatch commented
Under: Chapter 3: Build users Listing 11
The book shows UsersControllerTest
with no namespace nesting:
Listing 11. test/controllers/api/v1/users_controller_test.rb
# v------------- THIS BIT
class UsersControllerTest < ActionDispatch::IntegrationTest
...
... None generated code. Entered by you.
...
end
When I do the generation rails g controller api::v1::users
- I get additional namespace of Api::V1
generated:
require 'test_helper'
V----------- THIS BIT
class Api::V1::UsersControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
However, I did get the same namespace as Listing 12 for the users_controller.rb.
# app/controllers/api/v1/users_controllers.rb
class Api::V1::UsersController < ApplicationController
end
Note: If you make a change then Listing 11 then Listing 14 will need to be changed also.
madeindjs commented
This is a mistake because namespace is set in code repository of example: https://github.com/madeindjs/market_place_api_6/blob/master/test/controllers/api/v1/products_controller_test.rb
notapatch commented
OK I'm updating all the listings with the correct namespace