I have some javascript specs (using the jspec javascript framework) in my rails 3 project, living in the spec/javascript directory. How can I exclude the ruby files in the jspec project from being run when I run "rake spec"? RSpec::Core::RakeTask used to take a file list (which was usually generated with a glob pattern and an explicit call to Dir.glob). Now it only takes a glob pattern: http://rdoc.info/github/rspec/rspec-core/master/RSpec/Core/RakeTask#pattern-instance_method So how am I supposed to express the following in one glob pattern? Dir.glob("spec/**/*_spec.rb") - Dir.glob("spec/javascript/**/*_spec.rb") Or is there a better way that I''m missing entirely, Best, Scott -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20101106/9b2099ac/attachment-0001.html>
David Chelimsky
2010-Nov-06 23:16 UTC
[rspec-users] Custom File List for Rails 3 Spec Task
On Nov 6, 2010, at 5:04 PM, Scott Taylor wrote:> I have some javascript specs (using the jspec javascript framework) in my rails 3 project, living in the spec/javascript directory. How can I exclude the ruby files in the jspec project from being run when I run "rake spec"? > > RSpec::Core::RakeTask used to take a file list (which was usually generated with a glob pattern and an explicit call to Dir.glob). Now it only takes a glob pattern: > > http://rdoc.info/github/rspec/rspec-core/master/RSpec/Core/RakeTask#pattern-instance_method > > So how am I supposed to express the following in one glob pattern? > > Dir.glob("spec/**/*_spec.rb") - Dir.glob("spec/javascript/**/*_spec.rb") > > Or is there a better way that I''m missing entirely,Hey Scott, Something like: "spec/{models,views,controllers,helpers,requests}/**/*_spec.rb" You''d have to include any dirs I left out (if you have any others) in the curly brackets. Do you think that''s sufficient? Cheers, David -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20101106/22449455/attachment.html>
Thanks David. I didn''t realize Dir.glob was so capable. Here''s what I ended up coming up with. Notice that I had to remove the rspec task as it was previously defined (by rspec itself): https://gist.github.com/667421 Cheers, Scott On Nov 6, 2010, at 7:16 PM, David Chelimsky wrote:> On Nov 6, 2010, at 5:04 PM, Scott Taylor wrote: > >> I have some javascript specs (using the jspec javascript framework) in my rails 3 project, living in the spec/javascript directory. How can I exclude the ruby files in the jspec project from being run when I run "rake spec"? >> >> RSpec::Core::RakeTask used to take a file list (which was usually generated with a glob pattern and an explicit call to Dir.glob). Now it only takes a glob pattern: >> >> http://rdoc.info/github/rspec/rspec-core/master/RSpec/Core/RakeTask#pattern-instance_method >> >> So how am I supposed to express the following in one glob pattern? >> >> Dir.glob("spec/**/*_spec.rb") - Dir.glob("spec/javascript/**/*_spec.rb") >> >> Or is there a better way that I''m missing entirely, > > Hey Scott, > > Something like: "spec/{models,views,controllers,helpers,requests}/**/*_spec.rb" > > You''d have to include any dirs I left out (if you have any others) in the curly brackets. Do you think that''s sufficient? > > Cheers, > David > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20101108/abe24d61/attachment.html>