Selenium无法找到’spec’文件夹

因此,我正在尝试建立我的本地系统,以帮助完成仅使用rails的雇主的现有项目。 他们希望我主要关注rspec测试,因为项目几乎是function性的,我需要充实他们错过的东西。 但是,我无法获得’rake spec’来构建我的测试文件夹。 实际上,测试文件夹包含一些使用Selenium的基本用户登录测试(我没有写它们)。 以下是错误的跟踪:

/opt/local/lib/ruby/gems/1.8/gems/selenium-client-1.2.18/lib/selenium/rspec/spec_helper.rb:2:in 'require': no such file to load -- spec (LoadError) from /opt/local/lib/ruby/gems/1.8/gems/selenium-client-1.2.18/lib/selenium/rspec/spec_helper.rb:2 from /Users/cliffhess/ampms/spec/integration/user_registration_name_not_blank_spec.rb:5:in 'require' from /Users/cliffhess/ampms/spec/integration/user_registration_name_not_blank_spec.rb:5 from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in 'load' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in 'load_spec_files' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in 'map' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in 'load_spec_files' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in 'run' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in 'run_in_process' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in 'run' from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in 'autorun' from /opt/local/lib/ruby/gems/1.8/bin/rspec:19 rake aborted! 

事实上,我很确定我理解这个问题(也许?)。 selenium-clients的spec_helper.rb中的第2行说require 'spec' ,如果我没弄错的话,就是说selenium-client应该包含一个名为spec的文件夹,其中包含所有的rspec内容。 selenium-client没有这个文件夹,所以我对它应该如何首先要求文件夹有点困惑。 如果我将行更改为require 'rspec' ,那么在这个虚构的spec文件夹中还有许多其他引用也会导致rake中止。

我正在运行Ruby 1.8.7,Rails 3.0.3和最新版本的selenium。 任何帮助都会很棒,我已经被困在谷歌搜索这个问题超过一天了,并且无法提出修复。

我遇到了同样的问题,我尝试了一些让它可以运行的东西,所以我只是从我的问题中复制我的答案 – 使用Selenium时的LoadError:没有这样的文件要加载 – 规范


首先我找到了Cucumber + Webrat + Selenium指南 ,它非常有用

其次,我删除了

 require "selenium/rspec/spec_helper" require "spec/test/unit" 

并补充说

 require 'spec_helper' 

其中spec_helper包含在spec文件夹中

我还删除了append_after所有方法

基本上现在测试用例可以运行,这不是最好的解决方案,但这是我到目前为止所做的。

PS:需要从http://seleniumhq.org/download/下载Selenium服务器并使用java -jar selenium-server-standalone-2.0b2.jar运行服务器