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. I could glob them myself and run them all individually, but then I wouldn''t get the combined statistics at the end. Peace, Phillip
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 >
On Thu, Feb 11, 2010 at 12:13 AM, Mike Sassak <msassak at gmail.com> wrote:> 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.Or just "script/spec spec/models"> > 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 >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
David Chelimsky wrote:> On Thu, Feb 11, 2010 at 12:13 AM, Mike Sassak<msassak at gmail.com> wrote: > >> 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. >> > > Or just "script/spec spec/models" > >Thanks for the replies. It''s not as simple as I just want to spec all models. As I mentioned, I''m writing a wrapper script to automate some things that I repeatedly find myself doing or wanting to do. I am trying to do a very simple **/* pattern when I don''t pass a pattern as an argument. I don''t really want to have a conditional that says rake spec:models unless pattern when the rest of my code actually calls script/spec. David''s suggestion might work though. Right now, I do file = ARGV.at(0) if ARGV.size > 0 file = ''**/*'' unless file <some logic to determine what type of spec to run, which defines filename_partial> spec_path = "#{spec_path}/#{file}#{filename_partial}.rb" file can be "user", "admin/message", "admin/*", "*/message", or whatever I need it to be. That''s why I''m looking for the easiest way to run all of a given type. Eventually I''m going to add support for ~, like with Cucumber tags, except for specs. I did this in a wrapper for Cucumber features and it is working out well for me. I''ll keep kicking it around. I''m confident a reasonable solution is not far off. Peace, Phillip
Phillip, any updates on your efforts? I am keenly interested in a Cucumber tags like facility for RSpec Cheers, Ed Ed Howland http://greenprogrammer.wordpress.com http://twitter.com/ed_howland On Thu, Feb 11, 2010 at 7:15 AM, Phillip Koebbe <phillipkoebbe at gmail.com> wrote:> David Chelimsky wrote: >> >> On Thu, Feb 11, 2010 at 12:13 AM, Mike Sassak<msassak at gmail.com> ?wrote: >> >>> >>> 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. >>> >> >> Or just "script/spec spec/models" >> >> > > Thanks for the replies. It''s not as simple as I just want to spec all > models. As I mentioned, I''m writing a wrapper script to automate some things > that I repeatedly find myself doing or wanting to do. I am trying to do a > very simple **/* pattern when I don''t pass a pattern as an argument. I don''t > really want to have a conditional that says > > rake spec:models unless pattern > > when the rest of my code actually calls script/spec. David''s suggestion > might work though. Right now, I do > > file = ARGV.at(0) if ARGV.size > 0 > file = ''**/*'' unless file > <some logic to determine what type of spec to run, which defines > filename_partial> > spec_path = "#{spec_path}/#{file}#{filename_partial}.rb" > > file can be "user", "admin/message", "admin/*", "*/message", or whatever I > need it to be. That''s why I''m looking for the easiest way to run all of a > given type. Eventually I''m going to add support for ~, like with Cucumber > tags, except for specs. I did this in a wrapper for Cucumber features and it > is working out well for me. > > I''ll keep kicking it around. I''m confident a reasonable solution is not far > off. > > Peace, > Phillip > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Thu, Sep 16, 2010 at 9:24 PM, Ed Howland <ed.howland at gmail.com> wrote:> Phillip, any updates on your efforts? > > I am keenly interested in a Cucumber tags like facility for RSpecThough I haven''t been closely following RSpec 2, I think it''s going to have tags much like Cucumber. Regards, Craig -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100916/ef2b391c/attachment.html>
On Sep 16, 2010, at 8:24 PM, Ed Howland wrote:> On Thu, Feb 11, 2010 at 7:15 AM, Phillip Koebbe <phillipkoebbe at gmail.com> wrote: >> David Chelimsky wrote: >>> >>> On Thu, Feb 11, 2010 at 12:13 AM, Mike Sassak<msassak at gmail.com> wrote: >>> >>>> >>>> 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. >>>> >>> >>> Or just "script/spec spec/models" >>> >>> >> >> Thanks for the replies. It''s not as simple as I just want to spec all >> models. As I mentioned, I''m writing a wrapper script to automate some things >> that I repeatedly find myself doing or wanting to do. I am trying to do a >> very simple **/* pattern when I don''t pass a pattern as an argument. I don''t >> really want to have a conditional that says >> >> rake spec:models unless pattern >> >> when the rest of my code actually calls script/spec. David''s suggestion >> might work though. Right now, I do >> >> file = ARGV.at(0) if ARGV.size > 0 >> file = ''**/*'' unless file >> <some logic to determine what type of spec to run, which defines >> filename_partial> >> spec_path = "#{spec_path}/#{file}#{filename_partial}.rb" >> >> file can be "user", "admin/message", "admin/*", "*/message", or whatever I >> need it to be. That''s why I''m looking for the easiest way to run all of a >> given type. Eventually I''m going to add support for ~, like with Cucumber >> tags, except for specs. I did this in a wrapper for Cucumber features and it >> is working out well for me. >> >> I''ll keep kicking it around. I''m confident a reasonable solution is not far >> off. >> >> Peace, >> Phillip > Phillip, any updates on your efforts? > > I am keenly interested in a Cucumber tags like facility for RSpecFYI - there is an open issue on this: http://github.com/rspec/rspec-core/issues#issue/37 I''m planning to add this to 2.1, but likely not before, as I don''t view it as crucial to a 2.0 release, but I do view it as something we need to take some time working on to get right. Cheers, David
On 2010-09-16 8:24 PM, Ed Howland wrote:> On Thu, Feb 11, 2010 at 7:15 AM, Phillip Koebbe<phillipkoebbe at gmail.com> wrote: >> David Chelimsky wrote: >>> On Thu, Feb 11, 2010 at 12:13 AM, Mike Sassak<msassak at gmail.com> wrote: >>> >>>> 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. >>>> >>> Or just "script/spec spec/models" >>> >>> >> Thanks for the replies. It''s not as simple as I just want to spec all >> models. As I mentioned, I''m writing a wrapper script to automate some things >> that I repeatedly find myself doing or wanting to do. I am trying to do a >> very simple **/* pattern when I don''t pass a pattern as an argument. I don''t >> really want to have a conditional that says >> >> rake spec:models unless pattern >> >> when the rest of my code actually calls script/spec. David''s suggestion >> might work though. Right now, I do >> >> file = ARGV.at(0) if ARGV.size> 0 >> file = ''**/*'' unless file >> <some logic to determine what type of spec to run, which defines >> filename_partial> >> spec_path = "#{spec_path}/#{file}#{filename_partial}.rb" >> >> file can be "user", "admin/message", "admin/*", "*/message", or whatever I >> need it to be. That''s why I''m looking for the easiest way to run all of a >> given type. Eventually I''m going to add support for ~, like with Cucumber >> tags, except for specs. I did this in a wrapper for Cucumber features and it >> is working out well for me. >> >> I''ll keep kicking it around. I''m confident a reasonable solution is not far >> off. >> >> Peace, >> Phillip >>> Phillip, any updates on your efforts? > > I am keenly interested in a Cucumber tags like facility for RSpec >My original message was misleading. I didn''t mean to imply that I was working on adding support for tags to RSpec. Rather, when you invoke cucumber on the command line, you can exclude tags by prepending a tilde (~). When I originally posted that question, I was working on the ability to pass in patterns to include or exclude. As a simple example, suppose I wanted to run all admin controller specs except those having to do with messaging, I would use <command name> -c admin/* ~message But this hasn''t shown itself to be very important after all. In fact, I actually forgot that I had wanted to do it. Peace, Phillip
Thanks David and Phillip. Phillip, I was reading about RSpec 2?''s filter capabilities and it seemed that you were working on a wrapper to dynamically adding a configure block when the wrapper was passed an option. David, I see the work in 2.1 for this and it is just what I need. I want to turn off some describe blocks (via some sort of exclusion filter) normally, but optionally turn them on. First, I have to determine if (exclusion) filters applies to 1.3.0. And if they do, then I might try something like this: RSpec.configure do |c| c.exclusion_filter = { :if => lambda {|what| case what when :dont_run ENV[''EXCLUDE''] == ''true'' end } } end then to invoke: bin/rake spec EXCLUDE=true Cheers, Ed Ed Howland http://greenprogrammer.wordpress.com http://twitter.com/ed_howland