[rspec-users] Trying to spec all models

Mike Sassak msassak at gmail.com
Wed Feb 10 23:13:29 EST 2010


On Wed, Feb 10, 2010 at 10:17 PM, Phillip Koebbe
<phillipkoebbe at gmail.com> wrote:
> When I do
>
> script/spec -c -f n  spec/models/**/*_spec.rb
>
> I get
>
> /Library/Ruby/Gems/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:283:in
> `files_to_load': File or directory not found: spec/models/**/*_spec.rb
> (RuntimeError)
>
> Yet, if I go into irb and do
>
> Dir.glob('spec/models/**/*_spec.rb')
>
> I get
>
> ["spec/models/county_spec.rb", "spec/models/county_user_spec.rb",
> "spec/models/message_county_spec.rb", "spec/models/message_spec.rb",
> "spec/models/message_user_spec.rb", "spec/models/postman_spec.rb",
> "spec/models/user_spec.rb"]
>
> Does spec not glob? I'm working on a wrapper script and I'd like to be able
> to run all specs of a given type (controller, model, view) by passing a
> single switch (-c, -m, -v). It works when I have subdirectories (as I do
> with controllers), but it isn't working when I don't (as with models). The
> fact that glob picks up the files properly got me wondering, so I thought
> I'd ask.
>

When running script/spec from the CLI the globbing rules will depend
on the shell. Try searching Google for "bash globbing" (or whatever
shell you're using). But if all you need is to run all the model
specs, you could use "rake spec:models". That works well for me.

Mike

> I could glob them myself and run them all individually, but then I wouldn't
> get the combined statistics at the end.
>
> Peace,
> Phillip
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list