diff options
author | Arthur Neves <arthurnn@gmail.com> | 2015-01-23 20:35:13 -0500 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-03-18 09:52:17 +0100 |
commit | d1a5460e3eb939d8de780df9a6530b02fe6d5614 (patch) | |
tree | 956aa517b6d1ad7010ae7c5e179103c5af3dec2d /railties/test/test_unit | |
parent | d6ed046d30d6715f5ce7922f040b8731e3eecf27 (diff) | |
download | rails-d1a5460e3eb939d8de780df9a6530b02fe6d5614.tar.gz rails-d1a5460e3eb939d8de780df9a6530b02fe6d5614.tar.bz2 rails-d1a5460e3eb939d8de780df9a6530b02fe6d5614.zip |
Better file:line parsing and filter method by file too
Diffstat (limited to 'railties/test/test_unit')
-rw-r--r-- | railties/test/test_unit/runner_test.rb | 26 |
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 |