Jarmo Pertman
2011-Jun-01 14:14 UTC
[rspec-users] RSpec 2 not finding specs from subdirectories when trying to run specs from there
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? Jarmo
Chris Habgood
2011-Jun-01 14:22 UTC
[rspec-users] RSpec 2 not finding specs from subdirectories when trying to run specs from there
Try this in your spec helper file: Dir[Rails.root.join("spec/factories/**/*.rb")].each {|f| require f} On Wed, Jun 1, 2011 at 09:14, Jarmo Pertman <jarmo.p at gmail.com> 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? > > Jarmo > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- *"In matters of style, swim with the current; in matters of principle, stand like a rock." Thomas Jefferson * -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110601/f8b64e92/attachment.html>
David Chelimsky
2011-Jun-01 14:24 UTC
[rspec-users] RSpec 2 not finding specs from subdirectories when trying to run specs from there
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?
Jarmo Pertman
2011-Jun-01 14:52 UTC
[rspec-users] RSpec 2 not finding specs from subdirectories when trying to run specs from there
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
Jarmo Pertman
2011-Jun-01 14:57 UTC
[rspec-users] RSpec 2 not finding specs from subdirectories when trying to run specs from there
It is indeed related with Windows! C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>rspec spec/subdir . Finished in 0.0045 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\subdir . Finished in 0.040505 seconds 1 example, 0 failures C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>spec spec/subdir . Finished in 0.040505 seconds 1 example, 0 failures It needs path to be specified with unix-slashes... 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
David Chelimsky
2011-Jun-01 15:05 UTC
[rspec-users] RSpec 2 not finding specs from subdirectories when trying to run specs from there
On Jun 1, 2011, at 9:57 AM, Jarmo Pertman wrote:> It is indeed related with Windows! > > C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>rspec spec/subdir > . > > Finished in 0.0045 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\subdir > . > > Finished in 0.040505 seconds > > 1 example, 0 failures > > C:\Users\jarmo\Desktop\minu\projects\Ruby\myproject>spec spec/subdir > . > > Finished in 0.040505 seconds > > 1 example, 0 failures > > It needs path to be specified with unix-slashes...Please do me a favor and report this to http://github.com/rspec/rspec-core/issues. Thx> > 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 > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users