diff options
-rw-r--r-- | railties/lib/rails/commands/test.rb | 4 | ||||
-rw-r--r-- | railties/test/application/test_test.rb | 18 |
2 files changed, 18 insertions, 4 deletions
diff --git a/railties/lib/rails/commands/test.rb b/railties/lib/rails/commands/test.rb index 219c2fa4e0..cc0cc3d65a 100644 --- a/railties/lib/rails/commands/test.rb +++ b/railties/lib/rails/commands/test.rb @@ -1,9 +1,9 @@ require "rails/test_unit/minitest_plugin" if defined?(ENGINE_ROOT) - $: << File.expand_path("test", ENGINE_ROOT) + $LOAD_PATH << File.expand_path("test", ENGINE_ROOT) else - $: << File.expand_path("../../test", APP_PATH) + $LOAD_PATH << File.expand_path("../../test", APP_PATH) end exit Minitest.run(ARGV) diff --git a/railties/test/application/test_test.rb b/railties/test/application/test_test.rb index ef65c7a893..99d698114c 100644 --- a/railties/test/application/test_test.rb +++ b/railties/test/application/test_test.rb @@ -12,7 +12,7 @@ module ApplicationTests teardown_app end - test "truth" do + test "simple successful test" do app_file "test/unit/foo_test.rb", <<-RUBY require 'test_helper' @@ -26,6 +26,20 @@ module ApplicationTests assert_successful_test_run "unit/foo_test.rb" end + test "simple failed test" do + app_file "test/unit/foo_test.rb", <<-RUBY + require 'test_helper' + + class FooTest < ActiveSupport::TestCase + def test_truth + assert false + end + end + RUBY + + assert_unsuccessful_run "unit/foo_test.rb", "Failed assertion" + end + test "integration test" do controller "posts", <<-RUBY class PostsController < ActionController::Base @@ -289,7 +303,7 @@ Expected: ["id", "name"] def assert_unsuccessful_run(name, message) result = run_test_file(name) assert_not_equal 0, $?.to_i - assert result.include?(message) + assert_includes result, message result end |