ruby on rails - MiniTest testing wrong class -


i new minitest, have used rspec in past. have issue put move object table after been deleted. have 2 classes named similar 1 namespace , other not. see below description in code. of other gems using minitest minitest-spec-rails , shoulda. appreciated.

user.rb

class user < activerecord::base   self.table_name = 'users' end 

cache/user.rb

module cache   class user < activerecord::base     self.table_name = 'cache_users'   end end 

test/models/cache/user_test.rb

require 'test_helper'  module cache   class usertest < activesupport::testcase     #this tests user not cache::user   end end 

i found solution this.

class cache::usertest < activesupport::testcase   @model = cache::user #this tell we're testing end 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -