2012-03-24 64 views
1

我正在學習Ruby,必須做一些家庭作業,但在執行代碼時遇到問題。我搜索了這個論壇和谷歌,發現這可能是不同的Ruby版本的問題,但我不知道如何解決這個問題。我試着執行:Ruby版本的問題

cucumber features/filter_movie_list.feature 

,並得到這個:

而且我不應該看到的 'G' # 功能/ step_definitions/movie_steps.rb:32 沒有這樣的文件來加載 - - RSpec的/匹配器/ BUILT_IN /有(LoadError) ./features/step_definitions/movie_steps.rb:34:in /^(?:|I)should not see '([^']*)'$/' features/filter_movie_list.feature:37:in我不應該看到的 'G'」

有人可以幫助我解決這個proble米或給我鏈接解決方案?

編輯: movie_steps.rb有關此TAKS是:

Then /^(?:|I)should not see '([^']*)'$/ do |text| 
    if page.respond_to? :should 
    page.find('#movies').should have_no_content(text) 
    else 
    assert page.find('#movies').has_no_content?(text) 
    end 

end 
+0

你能更清楚你應該做什麼? – uday 2012-03-24 15:11:16

+0

顯示你的'movie_steps.rb' – 2012-03-24 17:20:37

+0

我編輯的問題。但我找到了解決辦法。解決方案是在Gemfile中添加rspec gem。 – 2012-03-24 18:08:49

回答

2

該錯誤消息說,黃瓜找不到RSpec的。

要解決它,編輯你的Gemfile並添加這些,應該解決它。

group :test do 
    gem 'rspec' # Behavior Driven Development (BDD) for Ruby 
    gem 'rspec-core' # RSpec runner and example groups. 
    gem 'rspec-expectations' # RSpec matchers for should and should_not. 
    gem 'rspec-mocks' # RSpec test double framework with stubbing and mocking. 
    gem 'rspec-rails' # RSpec version 2.x for Rails version 3.x. 
end 

如果不解決這個問題,你也許可以刪除除了第一個(在「rspec的」一)所有的線,因爲這條線應該走別人的照顧。