rails/rails — pull request #9173 by senny (2013-02-04 16:25:21+00:00)
Title: Backport rails/rails-perftest#2 to fix rake test:benchmark

This is a backport of https://github.com/rails/rails-perftest/pull/2 to fix #4938.

The rake task does now work but while testing I got problems with the `rails benchmarker` and `rails profiler` commands:

```
local-3-2-stable » rails profiler '10.times{"a string"}'
/Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/test/unit.rb:167:in `block in non_options': file not found: 10.times{"a string"} (ArgumentError)
from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/test/unit.rb:146:in `map!'
from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/test/unit.rb:146:in `non_options'
from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/test/unit.rb:207:in `non_options'
from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/test/unit.rb:52:in `process_args'
from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/minitest/unit.rb:891:in `_run'
from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/minitest/unit.rb:884:in `run'
from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/test/unit.rb:21:in `run'
from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
from /Users/senny/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
```

I could fix this by clearing `ARGV` after the ["on-the-fly-test-case"](https://github.com/senny/rails/blob/backport_perftest_fix/railties/lib/rails/commands/benchmarker.rb#L32) is defined. This would be another hacky workaround though and I'm open for better ideas.