开发者

rspec isn't finding examples

I have an almost-new Rails 3.1.0 application, and rspec can't find my examples.

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

Finished in 0.00004 seconds
0 examples, 0 failures

My spec direct开发者_运维百科ory looks like this:

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

And there are definitely examples in there. E.g. welcome_controller_spec.rb contains the following:

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

I'm running the following versions of rspec & related Gems:

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

Could someone please tell me how to convince rspec to find my examples? I suspect I'm missing something very simple here.


I'm getting the same results with bundle exec rspec, maybe it was deprecated. Try this instead:

 rspec spec


@calebB is correct for <= 2.6, but the 2.7 release won't require you to include the directory (it will default to spec).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜