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

rails c ⇒ odd, empty test runs. #115

Open
rking opened this issue Dec 3, 2012 · 6 comments
Open

rails c ⇒ odd, empty test runs. #115

rking opened this issue Dec 3, 2012 · 6 comments

Comments

@rking
Copy link

rking commented Dec 3, 2012

If you start with rails new foo && cd foo

Then edit the Gemfile to have:

group :development do
  gem 'turn'
  gem 'pry-rails'
end

Then run: rails c

Then hit ^D to exit the console, you'll get funky output like this:

Loaded Suite test,test/functional,test/unit,test/unit/helpers,test/performance
Started at 2012-12-03 05:56:45 +0000 w/ seed 23441.
Finished in 0.839736 seconds.
0 tests, 0 passed, 0 failures, 0 errors, 0 skips, 0 assertions

This doesn't happen:

  • without the turn gem
  • without the pry-rails gem (not even if you Pry.start from ~/.irbrc)

We haven't had time to look into it beyond seeing that:

  • It comes from the test autorun stuff
  • railties-3.2.9/lib/rails/console/app.rb has a funky hack:
# work around the at_exit hook in test/unit, which kills IRB
Test::Unit.run = true if Test::Unit.respond_to?(:run=)

Any clues about this one?

@rking
Copy link
Author

rking commented Dec 3, 2012

(Cross-posted to pry/pry-rails#31 )

@5long
Copy link
Contributor

5long commented Jan 8, 2013

Bundler automatically require "<gem name>" by default: http://gembundler.com/v1.2/man/gemfile.5.html#REQUIRE-AS-require-.

Since you probably only want to load turn when you run tests, I'd suggest bundling turn like this:

gem "turn", :require => false

And explicitly put require "turn/autorun" in tests/test_helper.rb.

@trans
Copy link
Contributor

trans commented Jan 8, 2013

The latest version of Turn shouldn't have this problem. That's why turn/autorun become necessary --so Bundler could load turn without triggering a test run. I wonder what pry-rails has to do it with it too. That's seems especially odd.

@rking
Copy link
Author

rking commented Mar 27, 2013

This is still present, as described above, with the GitHub master branch version of Turn.

@allaire
Copy link

allaire commented Apr 2, 2013

Solution from @5long fixed it for me, thanks!

@trans
Copy link
Contributor

trans commented Apr 2, 2013

Unfortunately the clash between Test::Unit and MiniTest has been a pain in the ass from day one. MiniTest should have never have usurped Test::Unit's namespace. That Bundler autoload's everything in the Gemfile only made matters worse.

I don't know why the railtie work around is being used. It seems like a mistake to me. Why would you run tests just b/c Test::Unit responds to #run=?

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

4 participants