diff options
author | Michael Grosser <michael@grosser.it> | 2016-09-16 09:26:10 -0700 |
---|---|---|
committer | Michael Grosser <michael@grosser.it> | 2016-09-16 09:34:34 -0700 |
commit | fe98d21289b7510182e338f352f5a416bd01f1ad (patch) | |
tree | 79c48329ae9641b46e81de09966723cc9e23fa38 /railties | |
parent | f62451a50b2c9119adce7acc53ce3dfffc4d41d5 (diff) | |
download | rails-fe98d21289b7510182e338f352f5a416bd01f1ad.tar.gz rails-fe98d21289b7510182e338f352f5a416bd01f1ad.tar.bz2 rails-fe98d21289b7510182e338f352f5a416bd01f1ad.zip |
improve test coverage
Diffstat (limited to 'railties')
-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 |