Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 directory 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.

like image 479
Duncan Bayne Avatar asked Oct 02 '11 02:10

Duncan Bayne


1 Answers

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

 rspec spec
like image 162
cbron Avatar answered Sep 28 '22 07:09

cbron