Hello. You''re saying that: To get rspec to behave as it did before this change, use this: --pattern "**/*.rb" I tried like this (rspec 1.03) and it wasn''t same as before (rspec 1.08). Now it also loads all other files in current directory and in all subdirectories and not only from directory and subdirectories given to spec as a parameter. So, for example, I have something like this: .\some_file.rb (which I don''t want to load) .\some_dir\some_other_dir\some_other_files.rb (I don''t want to load these also) .\my_test_dir (has many subdirs and rb files in it - I want to load all .rb files from THIS dir) now, I execute rspec like this: spec -p **/*.rb my_test_dir (and having working directory . of course). Now I get some errors and things (some of them need input parameters and so on) from the files I did not want to include and they weren''t included with previous versions. For example, it is going to load all rb files from "." and from "some_dir" and subdirectories. What''s wrong and how can I avoid that? I made simple test, created files called "main_spec.rb" to follow your naming convention. It had only one line in it: puts "spec: " + File.dirname(__FILE__) Now, I executed spec without -p (--pattern) switch to have it to use default option (which is **/*_spec.rb). Everything worked as with version 1.08. But NOW, if I executed spec with -p **/*_spec.rb (which is SAME as default option!) it loaded ALL *_spec.rb files from working directory and from every subdirectories (as supposed to all *_spec.rb files from directories and subdirectories given to spec as input parameter). It seems to be some bug. Any ideas? One way is to change working directory to "my_test_dir" prior executing rspec but it''s not comfortable also. Other way would be to rename all my tests to _spec.rb, which wouldn''t be also too big of a job. But the question still remains. Jarmo. David Chelimsky-2 wrote:> > Hello all, > > Just a heads up that I made a change (in svn trunk - not yet released) > that may change what files get loaded when you run the rake or spec > commands. Not a big deal if you''ve been following convention, but for > those who haven''t you may need to make a minor adjustment to your rake > file or spec.opts. > > http://blog.davidchelimsky.net/articles/2008/01/20/rspec-new-pattern-option > > Cheers, > David > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > >-- View this message in context: http://www.nabble.com/new---pattern-option-tp14983923p17484038.html Sent from the rspec-users mailing list archive at Nabble.com.
On May 27, 2008, at 2:35 AM, kasutaja wrote:> > Hello. > > You''re saying that: > To get rspec to behave as it did before this change, use this: > > --pattern "**/*.rb"That was an error. Use this instead: --pattern "spec/**/*.rb" or this if you want to avoid loading files other than spec files: --pattern "spec/**/*_spec.rb" This one is actually the default, so if that''s what you want you don''t need to use the option. I updated my blog post to reflect this: http://blog.davidchelimsky.net/articles/2008/01/20/rspec-new-pattern-option Cheers, David> I tried like this (rspec 1.03) and it wasn''t same as before (rspec > 1.08). > Now it also loads all other files in current directory and in all > subdirectories and not only from directory and subdirectories given > to spec > as a parameter. > > So, for example, I have something like this: > .\some_file.rb (which I don''t want to load) > .\some_dir\some_other_dir\some_other_files.rb (I don''t want to load > these > also) > .\my_test_dir (has many subdirs and rb files in it - I want to load > all .rb > files from THIS dir) > > now, I execute rspec like this: spec -p **/*.rb my_test_dir (and > having > working directory . of course). > > Now I get some errors and things (some of them need input parameters > and so > on) from the files I did not want to include and they weren''t > included with > previous versions. For example, it is going to load all rb files > from "." > and from "some_dir" and subdirectories. What''s wrong and how can I > avoid > that? > > I made simple test, created files called "main_spec.rb" to follow your > naming convention. It had only one line in it: > puts "spec: " + File.dirname(__FILE__) > > Now, I executed spec without -p (--pattern) switch to have it to use > default > option (which is **/*_spec.rb). Everything worked as with version > 1.08. But > NOW, if I executed spec with -p **/*_spec.rb (which is SAME as default > option!) it loaded ALL *_spec.rb files from working directory and > from every > subdirectories (as supposed to all *_spec.rb files from directories > and > subdirectories given to spec as input parameter). It seems to be > some bug. > Any ideas? > > One way is to change working directory to "my_test_dir" prior > executing > rspec but it''s not comfortable also. Other way would be to rename > all my > tests to _spec.rb, which wouldn''t be also too big of a job. But the > question > still remains. > > Jarmo. > > > David Chelimsky-2 wrote: >> >> Hello all, >> >> Just a heads up that I made a change (in svn trunk - not yet >> released) >> that may change what files get loaded when you run the rake or spec >> commands. Not a big deal if you''ve been following convention, but for >> those who haven''t you may need to make a minor adjustment to your >> rake >> file or spec.opts. >> >> http://blog.davidchelimsky.net/articles/2008/01/20/rspec-new-pattern-option >> >> Cheers, >> David >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> >> > > -- > View this message in context: http://www.nabble.com/new---pattern-option-tp14983923p17484038.html > Sent from the rspec-users mailing list archive at Nabble.com. > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
On 27 May 2008, at 12:37, David Chelimsky wrote:> I updated my blog post to reflect this: http://blog.davidchelimsky.net/articles/2008/01/20/rspec-new-pattern-optionJust out of curiosity, how come multiple patterns are specified comma- separated? It means I have to go and rename all the files I saved with extension ".rb," ;) Ashley -- http://www.patchspace.co.uk/ http://aviewfromafar.net/
On May 27, 2008, at 7:41 AM, Ashley Moran wrote:> > On 27 May 2008, at 12:37, David Chelimsky wrote: > >> I updated my blog post to reflect this: http://blog.davidchelimsky.net/articles/2008/01/20/rspec-new-pattern-option > > Just out of curiosity, how come multiple patterns are specified > comma-separated? It means I have to go and rename all the files I > saved with extension ".rb," ;)How would you do it?
On 27 May 2008, at 13:45, David Chelimsky wrote:> How would you do it?Everywhere I''ve seen something similar, it''s just been space- delimited, no punctuation. For example, this from the rsync man page: rsync -av host:''dir1/file1 dir2/file2'' /dest Not quite the same thing but it''s the closest I can think of off the top of my head. It doesn''t affect me really, I just noticed the syntax and thought it looked odd. Ashley -- http://www.patchspace.co.uk/ http://aviewfromafar.net/
On May 27, 2008, at 7:59 AM, Ashley Moran wrote:> > On 27 May 2008, at 13:45, David Chelimsky wrote: > >> How would you do it? > > > Everywhere I''ve seen something similar, it''s just been space- > delimited, no punctuation. For example, this from the rsync man > page: > rsync -av host:''dir1/file1 dir2/file2'' /destI was thinking more of ant patternsets (from my java days). I think they support comma or space separated, but all the examples I ever saw (or wrote) used commas. You said something about having to rename files - not sure I get it.> Not quite the same thing but it''s the closest I can think of off the > top of my head. > > It doesn''t affect me really, I just noticed the syntax and thought > it looked odd. > > Ashley > > > -- > http://www.patchspace.co.uk/ > http://aviewfromafar.net/ > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
On 27 May 2008, at 14:06, David Chelimsky wrote:> I was thinking more of ant patternsets (from my java days). I think > they support comma or space separated, but all the examples I ever > saw (or wrote) used commas.Ah ok, I guess it depends on your heritage. I''m lucky to have not had to build any serious Java projects. I did a lot with NAnt once upon a time, but I''ve successfully blocked that out of my mind. The therapy must have worked...> You said something about having to rename files - not sure I get it.Ignore me, I was just being stupid :) I don''t really put commas at the end of my filenames. I''m sure I''ve seen something that does though, but I can''t remember what. Ashley -- http://www.patchspace.co.uk/ http://aviewfromafar.net/
On Tue, May 27, 2008 at 10:12 AM, Ashley Moran <ashley.moran at patchspace.co.uk> wrote:> Ignore me, I was just being stupid :) I don''t really put commas at the end > of my filenames. I''m sure I''ve seen something that does though, but I can''t > remember what.RCS? -- Avdi Home: http://avdi.org Developer Blog: http://avdi.org/devblog/ Twitter: http://twitter.com/avdi Journal: http://avdi.livejournal.com
On 27 May 2008, at 15:15, Avdi Grimm wrote:> RCS?Yes! Something else I''ve never had the pleasure of using. I doubt any rspec users use RCS, but you never know. Ashley -- http://www.patchspace.co.uk/ http://aviewfromafar.net/
Seemingly Similar Threads
- Can I do foo.should (be_nil || be_empty) in rspec
- Any plans for Before-feature or Before-all steps in Cucumber?
- Sharing: dont_repeat_yourself plugin custom RSpec matcher
- mock_model not stubbing model attribtues in view spec
- Getting annotations in spec files.