[rspec-users] new --pattern option
dchelimsky at gmail.com
Tue May 27 07:37:47 EDT 2008
On May 27, 2008, at 2:35 AM, kasutaja wrote:
> 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:
or this if you want to avoid loading files other than spec files:
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
> I tried like this (rspec 1.03) and it wasn't same as before (rspec
> 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
> .\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
> 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
> 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
> 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
> 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
> 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
> still remains.
> David Chelimsky-2 wrote:
>> Hello all,
>> Just a heads up that I made a change (in svn trunk - not yet
>> 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
>> file or spec.opts.
>> rspec-users mailing list
>> rspec-users at rubyforge.org
> 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
More information about the rspec-users