aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-06-27 20:54:57 +0200
committerYves Senn <yves.senn@gmail.com>2013-06-27 21:11:03 +0200
commitb47f8d035ec6a38a69eb5b3bdb1e27bb40e574c7 (patch)
tree90dc22392fdcd324a9d50961577573abdb5bd53b /railties
parent1db54d7d01ea36a9d8c0c6276d66d04a9a6c2fac (diff)
downloadrails-b47f8d035ec6a38a69eb5b3bdb1e27bb40e574c7.tar.gz
rails-b47f8d035ec6a38a69eb5b3bdb1e27bb40e574c7.tar.bz2
rails-b47f8d035ec6a38a69eb5b3bdb1e27bb40e574c7.zip
clear ARGV to prevent mintest autorun errors:
Minitest expects the first argument in `ARGV` to be the path to a test file. Because `rails benchmarker` and `rails profiler` define an on-the-fly test-case, using the first `ARGV` to pass the code to execute this results in: ``` /Users/senny/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/test/unit.rb:167:in `block in non_options': file not found: 1000.times{"a string"} (ArgumentError) from /Users/senny/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/test/unit.rb:146:in `map!' from /Users/senny/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/test/unit.rb:146:in `non_options' from /Users/senny/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/test/unit.rb:207:in `non_options' from /Users/senny/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/test/unit.rb:52:in `process_args' from /Users/senny/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/minitest/unit.rb:891:in `_run' from /Users/senny/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/minitest/unit.rb:884:in `run' from /Users/senny/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/test/unit.rb:21:in `run' from /Users/senny/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun' from /Users/senny/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/test/unit.rb:27:in `run_once' from /Users/senny/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun' ``` clearing ARGV after defining the test-case solves this issue.
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md6
-rw-r--r--railties/lib/rails/commands/benchmarker.rb1
-rw-r--r--railties/lib/rails/commands/profiler.rb1
3 files changed, 8 insertions, 0 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index 9ecb37e903..43aed3f0e7 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,5 +1,11 @@
## unreleased ##
+* Fix bugs that crashed `rake test:benchmark`, `rails profiler` and
+ `rails benchmarker`.
+ Fixes #4938.
+
+ *Yves Senn*
+
* Add support for runner hook.
Backport #7695.
diff --git a/railties/lib/rails/commands/benchmarker.rb b/railties/lib/rails/commands/benchmarker.rb
index b9169468a3..a2d92f8956 100644
--- a/railties/lib/rails/commands/benchmarker.rb
+++ b/railties/lib/rails/commands/benchmarker.rb
@@ -30,4 +30,5 @@ class BenchmarkerTest < ActionDispatch::PerformanceTest #:nodoc:
end
RUBY
end
+ ARGV.clear
end
diff --git a/railties/lib/rails/commands/profiler.rb b/railties/lib/rails/commands/profiler.rb
index 3f6966b4f0..9b3b4f41f6 100644
--- a/railties/lib/rails/commands/profiler.rb
+++ b/railties/lib/rails/commands/profiler.rb
@@ -29,4 +29,5 @@ class ProfilerTest < ActionDispatch::PerformanceTest #:nodoc:
end
RUBY
end
+ ARGV.clear
end