[rspec-devel] [ rspec-Patches-10545 ] Removal of --options when appropriate

noreply at rubyforge.org noreply at rubyforge.org
Sun May 6 20:12:01 EDT 2007


Patches item #10545, was opened at 2007-05-03 07:19
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=10545&group_id=797

Category: runner module
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 3
Submitted By: Scott Taylor (smtlaissezfaire)
>Assigned to: David Chelimsky (dchelimsky)
Summary: Removal of --options when appropriate

Initial Comment:
Consider a spec command like the following:

spec some_spec --options filename.txt --format failing_examples:filename.txt

What happens when the file filename.txt does not exist?  The file gets created, and no specs are run.  This patch addresses this problem by removing the appropriate option.

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-05-07 00:12

Message:
OK - I applied 10636. I'll close this one and await your new RFE.

Thanks for playing.

Cheers,
David

----------------------------------------------------------------------

Comment By: Scott Taylor (smtlaissezfaire)
Date: 2007-05-07 00:02

Message:
Sure.  Actually, I think it would be better to close/reject
the ticket (since the title is misleading).  I'll open
another ticket with an appropriate title, and refer to this one.

Also - do you think that you could apply patch #10636?  It
is nothing more than added spec to the options parser.  This
patch will rely on that one (since they both use an empty file).

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-05-06 23:51

Message:
OK. I get it now. Thank you for explaining this again and clearing it up.

You mentioned that you were still working on the code - can I delete the patch that's attached to this RFE so I don't look at this in a few days and think it's the one I should use?

----------------------------------------------------------------------

Comment By: Scott Taylor (smtlaissezfaire)
Date: 2007-05-06 19:31

Message:
As for conflicting files/spec names:

Given the spec command:

spec some_spec.rb --examples failures.txt --failures
failures.txt

where failures.txt does not exist.  What specs are going to
be run?  RSpec can't find the failures file (since it does
not yet exist), and so it assumes that failures.txt is the
name of a failing example.

The failures file then gets created, and it looks to run an
example named "failures.txt."  Obviously this does not
exist, and so no specs will run.

----------------------------------------------------------------------

Comment By: Scott Taylor (smtlaissezfaire)
Date: 2007-05-06 19:26

Message:
Oh - Ok.  I thought it was obvious.  I'll try my best, but
if it's still not obvious, hopefully Aslak can help me out.

If I ran a spec command like the following:

spec some_spec.rb --examples failures.txt --failures
failures.txt

What is my intention here?  It is to run the examples given
in failures.txt, outputing any of the failing examples back
to failures.txt.  

Now if the examples file (failures.txt) is blank, then it
will run all of the specs.  I would get some output like this:

..............................................................................

Finished in 3.595967 seconds

78 examples, 0 failures


Now if the examples file does not exist, what should happen?
 Should it run none of the specs, or should it run all of
them, as if the examples file was empty?  It has always
seemed like it should work like the latter case.  If the
failures/examples file does not exist, it should create it,
then run all of the specs, and dump any failing ones to the
failures file.

As of now, it creates the file, but will not run *any* of
the specs:

Finished in 4.9e-05 seconds

0 examples, 0 failures


Right now there are two ways to get around this:
1. Create the failures file before running the command
2. Run the spec commmand twice.  The first time the failures
file will be created.  The second time it will run all
specs, dumping the failing ones to the failures file.

So this patch addresses that issue.  

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-05-06 19:09

Message:
I saw that thread, but it seemed unresolved, as does this thread. I'm probably just missing something obvious, but I simply don't understand the problem you are trying to solve. Can you please give a very clear example, with the spec names and file names you are worried about conflicting?

----------------------------------------------------------------------

Comment By: Scott Taylor (smtlaissezfaire)
Date: 2007-05-06 19:02

Message:
Well, in this case, you would use the e switch when you want
to read the examples from a file generated from a failing
example or failing behavior formatter.  

Aslak and I had a discussion about this on the mailing list
a few days ago.  Should I refer you to the thread?

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-05-06 17:04

Message:
So you're worried about people accidentally using the -e switch with an example that has the same name as a file? Same question applies. What is the likelihood that that would happen? I'm not completely opposed to it, but the case seems unlikely to me.

----------------------------------------------------------------------

Comment By: Scott Taylor (smtlaissezfaire)
Date: 2007-05-06 16:31

Message:
Sorry.  I messed up the post royally.  It should be
--examples instead of --options.  

I'm still working on some of the code, so feel free to
reject this one, and i'll open another ticket when I'm ready.  

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-05-06 16:21

Message:
It makes no sense that anybody would intentionally use the same filename for these two orthogonal concepts. Even if they do by accident, quietly processing only one file would make it even more difficult to understand what went wrong.

Am I missing something?

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=10545&group_id=797


More information about the rspec-devel mailing list