I'm fairly new to Ruby on rails and running into uninitialized constant issue when running tests. This is ROR is created with --api option and this what I've done so far:
After creating models for locations, users, and visits(this is many-to-many table for locations and users),
rails g controller v1/locations
rails g controller v1/visits
rails g controller v1/users
I ran three command lines to generate corresponding controllers. As you can see, I'm using v1 as a namespace assuming there will be v2, v3 and so on.
Then, I ran the following command line expecting no errors.
rails test test/controllers
and voila. I'm getting the following error message :(
Running via Spring preloader in process 66797
/Library/Ruby/Gems/2.3.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `block in load_missing_constant': uninitialized constant V1 (NameError)
from /Library/Ruby/Gems/2.3.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
from /Library/Ruby/Gems/2.3.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `rescue in load_missing_constant'
from /Library/Ruby/Gems/2.3.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `load_missing_constant'
from /Users/sangminkim/Desktop/friend-finder/test/controllers/v1/locations_controller_test.rb:3:in `<main>'
from /Library/Ruby/Gems/2.3.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
from /Library/Ruby/Gems/2.3.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
So... uninitialized constant V1 (NameError)?
Finding it odd, I checked out the auto-generated test file.
require 'test_helper'
class V1::LocationsControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
It looks like ROR doesn't understand V1::LocationsControllerTest part...
I tried changing the folder name(v1) to V1 thinking it might be an uppercase issue but no luck.
What am I missing here?
Thanks,
Update::
class V1::LocationsController < ApplicationController
end