2013-01-16 13 views
1

我正在開發一個gem。有一個文件夾名爲/規範,它包含2個文件:Rspec - Formatter'specdoc'unknown - 也許你的意思是'文檔'

#spec_helper.rb 
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) 
require 'my_gem' 

#my_gem_spec.rb 
describe MyGem do 
    it 'should have a version number' do 
    MyGem::VERSION.should_not be_nil 
    end 

    #............ 
end 

然後我運行它

rspec spec 
/var/lib/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:491:in `add_formatter': Formatter 'specdoc' unknown - maybe you meant 'documentation' or 'progress'?. (ArgumentError) 
     from /var/lib/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:30:in `block in configure' 
     from /var/lib/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:30:in `each' 
     from /var/lib/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb:30:in `configure' 
     from /var/lib/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/command_line.rb:21:in `run' 
     from /var/lib/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:80:in `run' 
     from /var/lib/gems/1.9.1/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:17:in `block in autorun' 

是什麼意思?如何擺脫它?

這裏是束的輸出

bundle install 
Using rake (10.0.3) 
Using diff-lcs (1.1.3) 
Using my_gem (0.0.1) from source at . 
Using rspec-core (2.12.2) 
Using rspec-expectations (2.12.1) 
Using rspec-mocks (2.12.1) 
Using rspec (2.12.0) 
Using bundler (1.3.0.pre.4) 
+0

如果您使用的寶石,這有一個問題[https://github.com/lazyatom/gem-this/pull/6](https://github.com/lazyatom/gem-this/pull/6) –

+0

@YevgeniyAnfilofyev,看看捆綁,沒有寶石 - 這個。 –

+0

我提到這一點,指出可能在Rakefile中的問題... –

回答

1

卸載rspec的及其依賴的所有先前版本。

gem uninstall rspec 
gem uninstall rspec-core 
gem uninstall rspec-mocks 
gem uninstall rspec-expectations 

在gem文件install rspec中安裝正確版本的rspec。

group :development, :test do 
    gem 'rspec-rails', '~> 3.0.0' 
end 

see this answer

相關問題