Ruby on rails 3.2 ';系统找不到指定的路径';使用Spree 1.1.0运行“rake test_应用程序”时
我在Rails 3.2和Spree 1.1上。运行初始Ruby on rails 3.2 ';系统找不到指定的路径';使用Spree 1.1.0运行“rake test_应用程序”时,ruby-on-rails-3.2,spree,Ruby On Rails 3.2,Spree,我在Rails 3.2和Spree 1.1上。运行初始rake test\u应用程序时--trace我得到: ** Invoke test_app (first_time) ** Execute test_app ** Invoke common:test_app (first_time) ** Execute common:test_app Generating dummy Rails application... Setting up dummy database... The system
rake test\u应用程序时--trace
我得到:
** Invoke test_app (first_time)
** Execute test_app
** Invoke common:test_app (first_time)
** Execute common:test_app
Generating dummy Rails application...
Setting up dummy database...
The system cannot find the path specified.
我正在从spree\core
运行rake test\u应用程序。据我从spree\core\lib\generators\spree\dummy\templates\rails\database.yml
,spree正在寻找db\spree\u test.sqlite3
。我试图手动创建这个数据库,但运气不好
如果有帮助的话,我也使用Windows 7,因为它可能是某种环境设置。这似乎是Spree generator中的一个小错误:
puts "Setting up dummy database..."
cmd = "bundle exec rake db:drop db:create db:migrate db:test:prepare"
if RUBY_PLATFORM =~ /mswin/ #windows
cmd += " >nul"
else
cmd += " >/dev/null"
end
system(cmd)
在我的例子中,RUBY_平台是“i386-mingw32”,else block添加了“>/dev/null”,这对于linux是有效的消音器,但在windows中会给出错误
因此,简单的解决方法可能是:
if RUBY_PLATFORM =~ /mswin|mingw/
正如我在文章中看到的,没有可靠的方法来确定操作系统的运行,但是有一些启发式代码
代码取自spree\core\lib\spree\testing\u support\common\u rake.rb
否则,您可以只运行:
bundle exec rake db:drop db:create db:migrate db:test:prepare
请告诉我们你达到这一点的步骤。我们很难调试这个问题,因为我们根本不知道你在哪里运行rake test\u app
。同样的错误,从本教程开始:现在(2017-01),检查平台是否是windows,你可以使用Gem.win\u platform?
cf