【问题标题】:rspec isn't finding examplesrspec 没有找到示例
【发布时间】:2012-07-16 23:07:02
【问题描述】:

我有一个几乎全新的 Rails 3.1.0 应用程序,而 rspec 找不到我的示例。

duncan@duncan-notebook:~/myapp$ bundle exec rspec
No examples found.

Finished in 0.00004 seconds
0 examples, 0 failures

我的规范目录如下所示:

spec/
|-- controllers
|   `-- welcome_controller_spec.rb
|-- factories
|   `-- users.rb
|-- helpers
|   `-- welcome_helper_spec.rb
|-- models
|   `-- user_spec.rb
|-- spec_helper.rb
`-- views
    `-- welcome
        `-- index.html.haml_spec.rb

那里肯定有例子。例如。 welcome_controller_spec.rb 包含以下内容:

require 'spec_helper'    
describe WelcomeController do    
  describe "GET 'index'" do
    it "should be successful" do
      get 'index'
      response.should be_success
    end
  end
end

我正在运行以下版本的 rspec 和相关 Gem:

  • rspec (2.6.0)
  • rspec-core (2.6.4)
  • rspec-expectations (2.6.0)
  • rspec 模拟 (2.6.0)
  • rspec-rails (2.6.1)
  • rubyzip (0.9.4)

有人可以告诉我如何说服 rspec 找到我的示例吗?我怀疑我在这里遗漏了一些非常简单的东西。

【问题讨论】:

    标签: ruby-on-rails rspec2


    【解决方案1】:

    我使用 bundle exec rspec 得到了相同的结果,也许它已被弃用。试试这个:

     rspec spec
    

    【讨论】:

    • rspec specbundle exec rspec spec 工作得很好。谢谢:-)
    【解决方案2】:

    @calebB 对于 spec)。

    【讨论】:

      猜你喜欢
      • 2012-11-02
      • 1970-01-01
      • 1970-01-01
      • 2012-06-07
      • 1970-01-01
      • 1970-01-01
      • 2018-03-03
      • 1970-01-01
      • 2017-02-13
      相关资源
      最近更新 更多