I have a ruby app that uses ActiveRecord and sqllite. I am trying to write tests but I get this error:
Failure/Error: user = described_class.create(name: name)
ActiveRecord::StatementInvalid:
Could not find table 'users'
This is my gemfile:
source "https://rubygems.org"
gem "sinatra-activerecord"
gem "sqlite3"
group :test do
gem 'database_cleaner'
end
group :test, :development do
gem "rspec-rails", ">= 2.1.0"
gem "pry"
end
I have a spec_helper that looks like this:
RSpec.configure do |config|
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'db/test.db')
end
What can I do to create a test database and run the migrations for my sqllite tests?