Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running single tests cases #9

Open
jstorimer opened this issue Nov 7, 2011 · 13 comments
Open

Running single tests cases #9

jstorimer opened this issue Nov 7, 2011 · 13 comments

Comments

@jstorimer
Copy link
Owner

spin push test/unit/product_test.rb -n /testing_price/
@jstorimer
Copy link
Owner Author

I was able to hack something together to make this work with test/unit. I'll push it later tonight.

Anyone know if RSpec supports this kind of behaviour?

@vizjerai
Copy link

RSpec supports sending a single file.

Typically the specs have require "spec_helper" at the top. Or have the correct requires at the top of the file to run the individual spec.

spin push spec/models/product_spec.rb

@dstrelau
Copy link
Collaborator

Looks like RSpec supports this as either a line number (spec foo.rb:42 / spec foo.rb --line 42) or a regex matching the example name (spec foo.rb --example bar / spec foo.rb -e bar).

@maprihoda
Copy link
Collaborator

I created a branch that makes it possible for RSpec users to run a single example by adding a line number.

The problem is that I'm not sure if this is the right way to go - it's very Rspec-centric, and as such, it does not enable any future extending (for TestUnit/Shoulda user, for example).

I have tried several other ways how to enable this (like not checking if the files exist, etc), but they all ended up being very complex and just impractical.

What do you think?

@matthuhiggins
Copy link

What if all options are blindly passed to the tests?

@maprihoda
Copy link
Collaborator

@matthuhiggins Can you please provide some example of what you mean?

@matthuhiggins
Copy link

In test/unit, autorun is enabled by default. It is implemented here: http://ruby-doc.org/stdlib-1.9.3/libdoc/test/unit/rdoc/Test/Unit/Runner.html#method-c-autorun. ARGV is passed in, where the "-n test_name" logic takes place. I was thinking that "spin push" could pass all those arguments to "spin serve", and spin serve would set ARGV.

@jstorimer
Copy link
Owner Author

@matthuhiggins that was the hack that I mentioned a while back, it does indeed work, but I haven't implemented the logic to actually pass the arguments yet. Anyone else tried?

@maprihoda
Copy link
Collaborator

I changed just the line 199 to socket.puts ARGV and all the rspec tests ran ok!

@jstorimer
Copy link
Owner Author

@maprihoda patch?

@maprihoda
Copy link
Collaborator

Unfortunately, with socket.puts ARGV, I'm getting a Broken pipe (Errno::EPIPE) when trying to push two or more files. Also, at this time, I'm not sure how to pass the arguments when using testunit (-n test_name just does not seem to work).

@accessd
Copy link

accessd commented Aug 22, 2012

There is a chance that this functionality will be?

@grosser
Copy link
Collaborator

grosser commented Aug 22, 2012

you can take a look at zeus, the basic implementation + run-by-line-number support is there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants