当我运行$ bundle exec rspec spec --format progress
它给出了这个错误:
..*....invalid option: --format
F**..**..***................*.*********
即使这是一个有效的选择。当我运行测试时,rspec
或者bundle exec rspec
所有测试都通过了。失败的测试是
1) Refinery::PagesController get all the methods succeeds
Failure/Error: rake.init
SystemExit:
exit
# ./spec/controllers/refinery/pages_controller_spec.rb:64:in `block (2 levels) in <top (required)>'
失败的规范是
require 'spec_helper'
require 'refinery/pages_controller'
require "rake"
describe Refinery::PagesController do
render_views
before do
...
# http://stackoverflow.com/questions/13704976/how-to-call-a-rake-task-in-rspec
rake = Rake::Application.new
Rake.application = rake
rake.init ### LINE 64
rake.load_rakefile
rake['categories:create'].invoke
为什么我不直接运行rspec
命令呢?因为 CircleCI(.com - 持续集成服务器) 是设置命令行的,我们无法控制它。
版本
Rails 3.2.14
$ gem list rspec
rspec (2.14.1)
rspec-core (2.14.8, 2.14.7)
rspec-expectations (2.14.5, 2.14.4)
rspec-mocks (2.14.6, 2.14.4)
rspec-rails (2.14.2, 2.14.1)
Gemfile.lock: rspec (2.14.1)
Gemfile.lock: rspec-core (2.14.7)
Gemfile.lock: rspec-expectations (2.14.4)
Gemfile.lock: rspec-mocks (2.14.4)
Gemfile.lock: rspec-rails (2.14.1)