[rspec-users] new --pattern option

kasutaja jarmo.p at gmail.com
Tue May 27 03:35:14 EDT 2008


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
.\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

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.


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.

More information about the rspec-users mailing list