Re: new --pattern option

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 C.-2 wrote:

Cheers,
David


rspec-users mailing list
[email protected]
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

On 27 May 2008, at 12:37, David C. 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,” :wink:

Ashley


http://www.patchspace.co.uk/

On 27 May 2008, at 13:45, David C. 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/

On May 27, 2008, at 7:41 AM, Ashley M. wrote:

On 27 May 2008, at 12:37, David C. 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,” :wink:

How would you do it?

On 27 May 2008, at 14:06, David C. 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 :slight_smile: 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/

On Tue, May 27, 2008 at 10:12 AM, Ashley M.
[email protected] wrote:

Ignore me, I was just being stupid :slight_smile: 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: Avdi Grimm, Code Cleric
Twitter: http://twitter.com/avdi
Journal: http://avdi.livejournal.com

On May 27, 2008, at 7:59 AM, Ashley M. wrote:

On 27 May 2008, at 13:45, David C. 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

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.

You said something about having to rename files - not sure I get it.

On 27 May 2008, at 15:15, Avdi G. 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/