ruby - In-Memory Sqlite DB in Rails with Rspec -


i have rails 4 application i'm attempting test in rspec using in-memory sqlite database. when run rake tells me

have 66 pending migrations. run `rake db:migrate` update database try again.

spec_helper.rb

env["rails_env"] ||= 'test'  require file.expand_path("../../config/environment", __file__) require 'rspec/rails' require 'capybara/rails' require 'capybara/rspec' require 'rspec/autorun' require 'capybara/poltergeist' require 'faker' require 'rake'  load_schema = lambda {   load "#{rails.root.to_s}/db/schema.rb" }  load_schema[]  ... 

why getting error? why need run migrations when i'm loading schema file? correct way test using sqlite in-memory db?

update

when running rake -t appears rake attempting run migrations

** invoke default (first_time) ** invoke spec (first_time) ** invoke test:prepare (first_time) ** invoke db:test:prepare (first_time) ** invoke db:load_config (first_time) ** execute db:load_config ** execute db:test:prepare ** invoke db:test:load (first_time) ** invoke db:test:purge (first_time) ** invoke environment (first_time) ** execute environment ** invoke db:load_config ** execute db:test:purge ** execute db:test:load ** invoke db:test:load_schema (first_time) ** invoke db:test:purge ** execute db:test:load_schema ** invoke db:schema:load (first_time) ** invoke environment ** invoke db:load_config ** execute db:schema:load ** invoke db:test:load ** invoke db:abort_if_pending_migrations (first_time) ** invoke environment ** execute db:abort_if_pending_migrations 

i don't need run migrations. possible override seemingly default behavior.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -