Duncan Bayne
Duncan Bayne

Reputation: 3959

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:

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

Upvotes: 5

Views: 3253

Answers (2)

David Chelimsky
David Chelimsky

Reputation: 9000

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

Upvotes: 3

cbron
cbron

Reputation: 4044

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

 rspec spec

Upvotes: 6

Related Questions