CruiseControl.rb 与 RSpec:Rake 任务“spec”;未找到

发布于 2025-01-08 15:01:40 字数 1204 浏览 5 评论 0原文

我正在尝试将 CruiseControl.rb(版本 2.0.0pre1)与 RSpec 用于我的 Ruby on Rails 3 应用程序。我的项目的 Cruise_config.rb 看起来像这样:

Project.configure do |project|
  project.rake_task = 'db:migrate db:test:prepare spec'
  project.scheduler.polling_interval = 1.hour
  project.scheduler.always_build = false
end

但是当我尝试使用 CruiseControl 运行构建时,它说:

rake aborted!
Custom rake task(s) 'spec' not defined

Tasks: TOP => cc:build
(See full trace by running task with --trace)

它找不到运行 RSpec 测试的 Spec rake 任务。我还尝试在 Rakefile 中定义自定义 rake 任务,并删除 中的 project.rake_task = 'db:migrate db:test:prepare spec' 行Cruise_config.rb:

desc "Custom Task for CruiseControl.rb"
task :cruise do
  puts "Custom Rake task"
  Rake::Task['db:migrate'].execute
  Rake::Task['db:test:prepare'].execute
  Rake::Task['spec'].execute
end

如果我这样做,CruiseControl会说

rake aborted!
ActiveRecord::ConnectionNotEstablished

Tasks: TOP => cruise
(See full trace by running task with --trace)
[CruiseControl] Invoking Rake task "cruise"
Custom Rake task

Does Anybody has CruiseControl.rb与RSpec一起工作?

I'm trying to use CruiseControl.rb (ver. 2.0.0pre1) with RSpec for my Ruby on Rails 3 app. The cruise_config.rb for my project looks like this:

Project.configure do |project|
  project.rake_task = 'db:migrate db:test:prepare spec'
  project.scheduler.polling_interval = 1.hour
  project.scheduler.always_build = false
end

But when I try to run a build with CruiseControl, it says:

rake aborted!
Custom rake task(s) 'spec' not defined

Tasks: TOP => cc:build
(See full trace by running task with --trace)

It can't find the spec rake task to run the RSpec tests. I also tried to define a custom rake task inside my Rakefile and removed the project.rake_task = 'db:migrate db:test:prepare spec' line inside the cruise_config.rb:

desc "Custom Task for CruiseControl.rb"
task :cruise do
  puts "Custom Rake task"
  Rake::Task['db:migrate'].execute
  Rake::Task['db:test:prepare'].execute
  Rake::Task['spec'].execute
end

If i do so, CruiseControl says

rake aborted!
ActiveRecord::ConnectionNotEstablished

Tasks: TOP => cruise
(See full trace by running task with --trace)
[CruiseControl] Invoking Rake task "cruise"
Custom Rake task

Does anybody have CruiseControl.rb working with RSpec?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生生漫 2025-01-15 15:01:40

确保您在 Rakefile 中定义了 :spec 任务,对于 RSpec 2,它如下所示:

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

Ensure that you have the :spec task defined in your Rakefile, for RSpec 2, it looks like this:

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文