1

我的问题/问题

我无法在清单3.9中运行非常基本的 rspec 测试,我觉得我缺少一些非常基本的东西,导致 static_pages_spec 返回 LoadError。有谁知道出了什么问题?

错误

E:\CSProj\RailsTutorial\sample_app>bundle exec rspec spec/request/static_pages_s pec.rb C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib /rspec /core/configuration.rb:780:in load': cannot load such file -- E:/CSProj/RailsTu torial/sample_app/spec/request/static_pages_spec.rb (LoadError) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core/configuration.rb:780:inblock in load_spec_files' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core /configuration.rb:780:in map' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core/configuration.rb:780:inload_spec_files' 来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core/command_line.rb:22 :in run' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core/runner.rb:69:inrun' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-2.1 1.1/lib/rspec/core/runner.rb:8:in `block in autorun '

编码

我正在使用以下代码:https ://github.com/adoliver/sample_app/blob/static-pages/spec/requests/static_pages_spec.rb

require 'spec_helper'

describe "Static pages" do

  describe "Home page" do

    it "should have the content 'Sample App'" do
      visit '/static_pages/home'
      page.should have_content('Sample App')
    end
  end
end

关于我的开发环境的一些信息

Windows 7 使用 railsInstaller 使用 windows 本机命令行 本教程中的前面步骤有效。

E:\CSProj\RailsTutorial\sample_app>ruby -v ruby​​ 1.9.3p125 (2012-02-16) [i386-mingw32]

E:\CSProj\RailsTutorial\sample_app>rails -v Rails 3.2.9

我的捆绑包:

E:\CSProj\RailsTutorial\sample_app>bundle list 包中包含的 Gems:

  • actionmailer (3.2.9)
  • 动作包 (3.2.9)
  • 活动模型(3.2.9)
  • 活动记录(3.2.9)
  • 活动资​​源(3.2.9)
  • 积极支持 (3.2.9)
  • 雷尔 (3.0.2)
  • 建设者(3.0.4)
  • 捆绑器 (1.0.22)
  • 水豚 (1.1.2)
  • 子进程(0.3.6)
  • 咖啡轨 (3.2.2)
  • 咖啡脚本(2.2.0)
  • 咖啡脚本源 (1.4.0)
  • diff-lcs (1.1.3)
  • 厄鲁比斯 (2.7.0)
  • 执行js (1.4.0)
  • 菲(1.2.0)
  • 远足 (1.2.1)
  • i18n (0.6.1)
  • 旅程 (1.0.4)
  • jquery-rails (2.0.2)
  • json (1.7.5)
  • libwebsocket (0.1.6.1)
  • 邮件 (2.4.4)
  • 哑剧类型 (1.19)
  • multi_json (1.3.7)
  • nokogiri (1.5.5)
  • 多语言(0.3.3)
  • 机架 (1.4.1)
  • 机架缓存 (1.2)
  • 机架 SSL (1.3.2)
  • 机架测试(0.6.2)
  • 导轨 (3.2.9)
  • 铁路(3.2.9)
  • 耙子 (10.0.2)
  • rdoc (3.12)
  • rspec (2.11.0)
  • rspec 核心 (2.11.1)
  • rspec-expectations (2.11.3)
  • rspec 模拟 (2.11.3)
  • rspec-rails (2.11.0)
  • rubyzip (0.9.9)
  • 萨斯(3.2.3)
  • sass-rails (3.2.5)
  • 硒网络驱动程序(2.26.0)
  • 链轮 (2.2.1)
  • sqlite3 (1.3.5)
  • 雷神 (0.16.0)
  • 倾斜 (1.3.3)
  • 树顶 (1.4.12)
  • tzinfo (0.3.35)
  • 丑化者 (1.2.3)
  • 网络套接字(1.0.3)
  • xpath (0.1.4)
4

1 回答 1

0

您报告:

load': cannot load such file -- E:/CSProj/RailsTu torial/sample_app/spec/request/static_pages_spec.rb (LoadError)

我不知道这是否愚蠢,但我的目录树中的规范在/app/spec/requests,而不是app/spec/request.

于 2012-11-20T22:16:37.530 回答