I develop Sinatra application and use there ActiveRecord for working with database, but I encountered one problem. I wrote a test for a model and it breaks with
SQLite3::CantOpenException: unable to open database file
Connection to database is established in test_helper.rb with the following code:
Dir.chdir('..') do
ActiveRecord::Base.establish_connection(db_config)
end
and ActiveRecord::Base.connected?
get false. If I call User.find(:all)
for example after connection establishment test will pass and ActiveRecord::Base.connected?
will be true. Why? I don't understand.