Rspec finds no examples

I have an almost new Rails 3.1.0 application and rspec cannot find my examples.

duncan@duncan-notebook :~/myapp$ bundle exec rspec No examples found. Finished in 0.00004 seconds 0 examples, 0 failures 

My specification is as follows:

 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 certain examples. For instance. 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 run the following versions of rspec and related jewelry:

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

Can someone please tell me how to convince rspec to find my examples? I suspect that I am missing something very simple here.

+4
source share
2 answers

I get the same results with the exec rspec package, maybe it is deprecated. Try instead:

  rspec spec 
+5
source

@calebB is true for <= 2.6, but release 2.7 does not require you to include a directory (by default it will be spec ).

+3
source

All Articles