I have this users_controller
class Api::V1::UsersController < ApplicationController
respond_to :json
def show
respond_with User.find(params[:id])
end
end
The file is in app/controllers/api/v1/
And my test is :
class Api::V1::UsersControllerTest < ActionController::TestCase
test '#show displays the specific user' do
@user = FactoryGirl.build(:user)
get :show, id: @user.id
assert_response :success
end
end
The file is in test/controllers/api/v1
When I run the test I get this error :
NameError: uninitialized constant Api
/Users/Ahmad/rails_apps/json_api/test/controllers/api/v1/users_controller_test.rb:1:in `<top (required)>'
What's going on?
Thanks
I think you miss
require 'test_helper'
at the top of your file. Give a try.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.