[rspec-users] RSpec 2 not finding specs from subdirectories when trying to run specs from there

Jarmo Pertman jarmo.p at gmail.com
Wed Jun 1 10:52:54 EDT 2011


I created a really simple example as shown above and this doesn't work
for me - e.g. no spec_helper or .rspec files in use. I'm on Windows,
could that be the culprit (it happens on two machines)? Here is some
additional output:

C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>tree
Folder PATH listing
Volume serial number is E4DF-948C
C:.
└───spec
    └───subdir

C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>ls -laR
total 0
drwxrwxrwx   1 user     group           0 Jun  1 17:01 .
drwxrwxrwx   1 user     group           0 Jun  1 06:15 ..
drwxrwxrwx   1 user     group           0 Jun  1 17:47 spec

spec=:
total 0
drwxrwxrwx   1 user     group           0 Jun  1 17:47 .
drwxrwxrwx   1 user     group           0 Jun  1 17:01 ..
drwxrwxrwx   1 user     group           0 Jun  1 17:46 subdir

spec\subdir=:
total 1
drwxrwxrwx   1 user     group           0 Jun  1 17:46 .
drwxrwxrwx   1 user     group           0 Jun  1 17:47 ..
-rw-rw-rw-   1 user     group          49 Jun  1 17:46 my_spec.rb

C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>cat spec\subdir
\my_spec.rb
describe "my" do
  it "example" do
  end
end

C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>rspec spec
.

Finished in 0.001 seconds
1 example, 0 failures

C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>spec spec
.

Finished in 0.037002 seconds

1 example, 0 failures

C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>rspec spec\subdir
No examples found.


Finished in 0 seconds
0 examples, 0 failures

C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>spec spec
.

Finished in 0.037003 seconds

1 example, 0 failures

C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>gem list | grep
rspec
rspec (2.6.0, 2.5.0, 2.3.0, 2.1.0, 1.3.1, 1.3.0)
rspec-core (2.6.3, 2.5.1, 2.3.1, 2.3.0, 2.2.1, 2.1.0)
rspec-expectations (2.6.0, 2.5.0, 2.3.0, 2.2.0, 2.1.0)
rspec-mocks (2.6.0, 2.5.0, 2.3.0, 2.2.0, 2.1.0)
rspec-rails (2.3.1, 2.1.0)

Jarmo

On Jun 1, 5:24 pm, David Chelimsky <dchelim... at gmail.com> wrote:
> On Jun 1, 2011, at 9:14 AM, Jarmo Pertman wrote:
>
> > Hi!
>
> > When having a file structure like this:
> > project
> >  -spec
> >    -subdir
> >      -my_spec.rb
>
> > and then being in directory "project" and running command `rspec spec`
> > everything works as expected. If running `rspec spec/subdir` to run
> > only specs under spec/subdir then it doesn't work - it finds 0
> > examples. It works as expected in RSpec 1. What do we do wrong?
>
> I run subdirectories quite often and haven't seen this issue. What's in your .rspec and spec/spec_helper.rb files? Also, which version of rspec-2 are you using?
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list