How to stub a model (in factory_girl way) which is an activerecord points to another database.

52 views
Skip to first unread message

Andy

unread,
Dec 8, 2009, 2:14:35 AM12/8/09
to factory_girl
I guess my case is a bit confusing, however, my application shares
other database via readonly database, but when I wanna use its
instance to test functions, the test failed and said :

ActiveRecord::StatementInvalid in 'User about trial lessons should be
able to load trial lessons'
Mysql::Error: Table 'studycenter_test.users' doesn't exist: SHOW
FIELDS FROM `users`
/home/andy/.gem/ruby/1.8/gems/thoughtbot-factory_girl-1.2.2/lib/
factory_girl/proxy/stub.rb:7:in `new'
/home/andy/.gem/ruby/1.8/gems/thoughtbot-factory_girl-1.2.2/lib/
factory_girl/proxy/stub.rb:7:in `initialize'
/home/andy/.gem/ruby/1.8/gems/thoughtbot-factory_girl-1.2.2/lib/
factory_girl/factory.rb:284:in `new'
/home/andy/.gem/ruby/1.8/gems/thoughtbot-factory_girl-1.2.2/lib/
factory_girl/factory.rb:284:in `run'
/home/andy/.gem/ruby/1.8/gems/thoughtbot-factory_girl-1.2.2/lib/
factory_girl/factory.rb:253:in `stub'
./spec/models/user_spec.rb:6:

Obviously, there is no users table in studycenter_test db in this
case, how can I configure or dummy it?

Thanks for your ideas.
Reply all
Reply to author
Forward
0 new messages