test-first-ruby 00_hello解析错误:OptionParser :: InvalidOption

时间:2014-08-06 20:37:42

标签: ruby parsing rspec

我很难弄清楚Test-First Ruby的第一课(Alex Chaffee),我正在进行“rake”测试并且遇到了我不应该收到的错误。

我已尝试执行gem update --system并删除之前帖子中建议的空格。这些都没有解决问题。

贝娄是我收到的规格和错误。

我将不胜感激任何帮助。

ruby 1.9.3p545 (2014-02-24) [i386-mingw32]

C:\Users\Greice>gem list

*** LOCAL GEMS ***

activemodel (4.1.4)
activerecord (4.1.4)
activesupport (4.1.4)
arel (5.0.1.20140414130214)
bigdecimal (1.2.5, 1.1.0)
builder (3.2.2)
bundler (1.6.5)
diff-lcs (1.2.5)
feedtools (0.2.29)
hpricot (0.8.6)
i18n (0.6.11)
io-console (0.4.2, 0.3)
json (1.8.1, 1.5.5)
minitest (5.4.0, 2.5.1)
rake (10.3.2, 0.9.2.2)
rdoc (4.1.1, 3.9.5)
RedCloth (4.2.9 x86-mingw32)
rspec (3.0.0, 2.0.1)
rspec-core (3.0.3, 2.0.1)
rspec-expectations (3.0.3, 2.0.1)
rspec-mocks (3.0.3, 2.0.1)
rspec-support (3.0.3)
rubygems-update (2.4.1)
sunlight-congress (1.1.0)
thread_safe (0.3.4)
tzinfo (1.2.1)
uuidtools (2.1.4)


C:\Users\Greice\Desktop\test-first-ruby-master>cd 00_hello

C:\Users\Greice\Desktop\test-first-ruby-master\00_hello>rake
(in C:/Users/Greice/Desktop/test-first-ruby-master)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core/option_parse
r.rb:18:in `parse!': invalid option: --warnings (OptionParser::InvalidOption)
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/option_parser.rb:4:in `parse!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/configuration_options.rb:78:in `parse_options_file'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/configuration_options.rb:74:in `parse_global_options'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/configuration_options.rb:48:in `parse_options'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/runner.rb:41:in `run'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.0.1/lib/rspec/core
/runner.rb:10:in `block in autorun'
rake aborted!
ruby -S bundle exec rspec -IC:/Users/Greice/Desktop/test-first-ruby-master/00_he
llo -IC:/Users/Greice/Desktop/test-first-ruby-master/00_hello/solution -f docume
ntation -r ./rspec_config "C:/Users/Greice/Desktop/test-first-ruby-master/00_hel
lo/hello_spec.rb" failed

Tasks: TOP => default => spec
(See full trace by running task with --trace)

Rake文件

# This Rakefile has all the right settings to run the tests inside each lab
gem 'rspec', '~>2'
require 'rspec/core/rake_task'

task :default => :spec

desc "run tests for this lab"
RSpec::Core::RakeTask.new do |task|
  lab = Rake.application.original_dir.gsub(' ', '\ ')
  task.pattern = "#{lab}/*_spec.rb"
  task.rspec_opts = [ "-I#{lab}", "-I#{lab}/solution", '-f documentation', '-r ./rspec_config']
  task.verbose = false
end

rspec_config.rb

RSpec.configure do |c|
  c.fail_fast = true
  c.color = true
end

1 个答案:

答案 0 :(得分:0)

我在--warnings文件中.rspec选项之前就看到了这一点。

尝试从--warnings.rspec文件中删除rspec_config行。