2
votes

I've created an app using Ruby on Rails and Spree.

After changing my SQlite database to PostgreSQL I needed to migrate my database. But when I try to run rake db:migrate, rake db:migrate RAILS_ENV=development, bin/rake db:migrate RAILS_ENV=development I get the same error.

rake aborted!
Don't know how to build task 'db:migrate:up' (see --tasks)
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)

When I run --trace I get the following response

** Invoke default (first_time)
** Invoke spec (first_time)
** Execute spec
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -I/usr/local/rvm/gems/ruby-2.3.0/gems/rspec-core-3.7.0/lib:/usr/local/rvm/gems/ruby-2.3.0/gems/rspec-support-3.7.0/lib /usr/local/rvm/gems/ruby-2.3.0/gems/rspec-core-3.7.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
Could not load dummy application. Please ensure you have run `bundle exec rake test_app`
** Execute default

Does any of you know what the cause of the problem is and what I should do?

Rakefile

require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'spree/testing_support/common_rake'


RSpec::Core::RakeTask.new

task default: :spec

desc "Generates a dummy app for testing"
task :test_app do
  ENV['LIB_NAME'] = 'spree/frontend'
  Rake::Task['common:test_app'].invoke
end
1
what version of Rails? And of rvm?dcorking
Your rakefile looks rather wird. Add these require File.expand_path('../config/application', __FILE__) and this YouApp::Application.load_tasks to your Rakefilenattfodd
@nattfodd can you add this as answer?Salman

1 Answers

2
votes

I added,

require File.expand_path('../config/application', __FILE__)

and

YouApp::Application.load_tasks

to my rake file.

Credits go to @nattfodd