Rspec 2.8.0,期望(某事)导致ArgumentError:错误的参数数量(1表示0)
我有一个新的repo(非rails)与rspec 2.8.0。
出于某些奇怪的原因,我无法使用expect语法。
这个荒谬的规范:
require "spec_helper" describe "The Truth" do it "is true" do expect(true).to be_true end end
原因:
Failure/Error: expect(true).to be_true ArgumentError: wrong number of arguments (1 for 0)
spec_helper
RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 config.order = 'random' config.expect_with :rspec do |c| c.syntax = :expect end end
在这里它表示期望语法来自rspec 2.11,所以我猜2.8是旧的http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax