diff options
author | Arthur Neves <arthurnn@gmail.com> | 2015-01-29 10:39:43 -0500 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-03-18 09:52:18 +0100 |
commit | de94929d70d94fd8bb20791bf544ee483db8ddc1 (patch) | |
tree | 6a5cd71e4889ff704f2a9f122e1fc0e67636739c /railties/test | |
parent | 3cc783b6bf20da27079038e7c52ce214f1042df3 (diff) | |
download | rails-de94929d70d94fd8bb20791bf544ee483db8ddc1.tar.gz rails-de94929d70d94fd8bb20791bf544ee483db8ddc1.tar.bz2 rails-de94929d70d94fd8bb20791bf544ee483db8ddc1.zip |
Fix relative dir call on test runner
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/test_unit/runner_test.rb | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/railties/test/test_unit/runner_test.rb b/railties/test/test_unit/runner_test.rb index 94f338344d..e8623bef67 100644 --- a/railties/test/test_unit/runner_test.rb +++ b/railties/test/test_unit/runner_test.rb @@ -30,16 +30,18 @@ class TestUnitTestRunnerTest < ActiveSupport::TestCase end test "parse the filename and line" do - options = @options.parse(["foobar.rb:20"]) - assert_equal File.expand_path("foobar.rb"), options[:filename] + file = "test/test_unit/runner_test.rb" + absolute_file = __FILE__ + options = @options.parse(["#{file}:20"]) + assert_equal absolute_file, options[:filename] assert_equal 20, options[:line] - options = @options.parse(["foobar.rb:"]) - assert_equal File.expand_path("foobar.rb"), options[:filename] + options = @options.parse(["#{file}:"]) + assert_equal [absolute_file], options[:patterns] assert_nil options[:line] - options = @options.parse(["foobar.rb"]) - assert_equal File.expand_path("foobar.rb"), options[:filename] + options = @options.parse([file]) + assert_equal [absolute_file], options[:patterns] assert_nil options[:line] end @@ -56,16 +58,18 @@ class TestUnitTestRunnerTest < ActiveSupport::TestCase end test "run all tests in a directory" do - options = @options.parse([__dir__]) + dir = Pathname.new(__dir__).basename.to_s + options = @options.parse([dir]) assert_equal ["#{__dir__}/**/*_test.rb"], options[:patterns] assert_nil options[:filename] assert_nil options[:line] end - test "run multiple files" do + test "run multiple folders" do application_dir = File.expand_path("#{__dir__}/../application") - options = @options.parse([__dir__, application_dir]) + + options = @options.parse([Pathname.new(__dir__).basename.to_s, Pathname.new(application_dir).basename.to_s]) assert_equal ["#{__dir__}/**/*_test.rb", "#{application_dir}/**/*_test.rb"], options[:patterns] assert_nil options[:filename] @@ -77,7 +81,7 @@ class TestUnitTestRunnerTest < ActiveSupport::TestCase test "run multiple files and run one file by line" do line = __LINE__ - options = @options.parse([__dir__, "#{__FILE__}:#{line}"]) + options = @options.parse([Pathname.new(__dir__).basename.to_s, "#{__FILE__}:#{line}"]) assert_equal ["#{__dir__}/**/*_test.rb"], options[:patterns] assert_equal __FILE__, options[:filename] |