Reputation: 1795
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
Upvotes: 1
Views: 50
Reputation: 5197
I think you miss
require 'test_helper'
at the top of your file. Give a try.
Upvotes: 1