aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/test_unit/runner_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/test_unit/runner_test.rb')
-rw-r--r--railties/test/test_unit/runner_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/railties/test/test_unit/runner_test.rb b/railties/test/test_unit/runner_test.rb
index cfc1d897b9..fa906d4080 100644
--- a/railties/test/test_unit/runner_test.rb
+++ b/railties/test/test_unit/runner_test.rb
@@ -18,4 +18,30 @@ class TestUnitTestRunnerTest < ActiveSupport::TestCase
options = @options.parse(["--backtrace"])
assert options[:backtrace]
end
+
+ test "parse the filename and line" do
+ options = @options.parse(["foobar.rb:20"])
+ assert_equal File.expand_path("foobar.rb"), options[:filename]
+ assert_equal 20, options[:line]
+
+ options = @options.parse(["foobar.rb:"])
+ assert_equal File.expand_path("foobar.rb"), options[:filename]
+ assert_nil options[:line]
+
+ options = @options.parse(["foobar.rb"])
+ assert_equal File.expand_path("foobar.rb"), options[:filename]
+ assert_nil options[:line]
+ end
+
+ test "find_method on same file" do
+ options = @options.parse(["#{__FILE__}:#{__LINE__}"])
+ runner = Rails::TestRunner.new(options)
+ assert_equal "test_find_method_on_same_file", runner.find_method
+ end
+
+ test "find_method on a different file" do
+ options = @options.parse(["foobar.rb:#{__LINE__}"])
+ runner = Rails::TestRunner.new(options)
+ assert_nil runner.find_method
+ end
end