Skip to content

Instantly share code, notes, and snippets.

@skatkov
Created October 27, 2017 12:57
Show Gist options
  • Save skatkov/984165cb80cfb37c37b74dec03b48f62 to your computer and use it in GitHub Desktop.
Save skatkov/984165cb80cfb37c37b74dec03b48f62 to your computer and use it in GitHub Desktop.
TypeError: superclass mismatch for class UsersController
#file: app/controllers/tsheets/users_controller.rb
module Tsheets
class UsersController < ApplicationController
def update
# does something important here
render json: 'test: test'
end
end
end
# file: test/controller/tsheets_users_controller_test.rb
require 'test_helper'
require_relative '../../app/controllers/tsheets/users_controller'
class Tsheets::UsersController < ActionController::TestCase
setup do
@user = users(:one)
sign_in(@user)
end
test "#update" do
get :update, format: :json
assert_response :success
end
end
# file: app/controllers/users_controller.rb
class UsersController < ApplicationController
def index
end
def show
end
end
@skatkov
Copy link
Author

skatkov commented Oct 27, 2017

Error I received then running this test.

TypeError: superclass mismatch for class UsersController
/Users/sk/client/Service_Phase_1/test/controllers/tsheets_users_controller_test.rb:4:in `<top (required)>'

@HumayunNaseer
Copy link

i have a same error , can you please tell me the solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment