diff options
author | Arthur Neves <arthurnn@gmail.com> | 2015-03-19 10:16:05 -0400 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2015-03-19 10:16:05 -0400 |
commit | 45786be516e13d55a1fca9a4abaddd5781209103 (patch) | |
tree | c6b3ef4e56e9e11758a005da32fced68f4e5c2f4 | |
parent | 9959e9525b9bd3324288c87f1c791cbb488c36c8 (diff) | |
parent | a9eb12393fa1245620533a58ed36f651558ecae8 (diff) | |
download | rails-45786be516e13d55a1fca9a4abaddd5781209103.tar.gz rails-45786be516e13d55a1fca9a4abaddd5781209103.tar.bz2 rails-45786be516e13d55a1fca9a4abaddd5781209103.zip |
Merge branch 'bin_test_runner'. #19216
3 commits were missing when we merged the PR, probably they were lost
when that branch was rebased against latest master.
This merge, contains those 3 commits.
-rw-r--r-- | Gemfile | 1 | ||||
-rw-r--r-- | Gemfile.lock | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/Gemfile | 4 | ||||
-rw-r--r-- | railties/lib/rails/test_unit/runner.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/test_unit/testing.rake | 4 | ||||
-rw-r--r-- | railties/railties.gemspec | 1 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 7 | ||||
-rw-r--r-- | railties/test/test_unit/runner_test.rb | 9 |
8 files changed, 10 insertions, 20 deletions
@@ -60,7 +60,6 @@ instance_eval File.read local_gemfile if File.exist? local_gemfile group :test do # FIX: Our test suite isn't ready to run in random order yet gem 'minitest', '< 5.3.4' - gem 'method_source' platforms :mri_19 do gem 'ruby-prof', '~> 0.11.2' diff --git a/Gemfile.lock b/Gemfile.lock index 1139e05aa5..cd360958d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -87,6 +87,7 @@ PATH railties (5.0.0.alpha) actionpack (= 5.0.0.alpha) activesupport (= 5.0.0.alpha) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) @@ -261,7 +262,6 @@ DEPENDENCIES json kindlerb (= 0.1.1) mail! - method_source minitest (< 5.3.4) mocha (~> 0.14) mysql (>= 2.9.0) diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index 82a0315379..c11bb58bfa 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -36,10 +36,6 @@ group :development, :test do # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' <% end -%> - - # Adds `Method#source` and `Method#comment` to get the source code of a - # method from the console - gem 'method_source' <% end -%> end <% if RUBY_PLATFORM.match(/bccwin|cygwin|emx|mingw|mswin|wince|java/) -%> diff --git a/railties/lib/rails/test_unit/runner.rb b/railties/lib/rails/test_unit/runner.rb index aec4707947..6700d90a33 100644 --- a/railties/lib/rails/test_unit/runner.rb +++ b/railties/lib/rails/test_unit/runner.rb @@ -129,7 +129,7 @@ module Rails location = method.source_location start_line = location.last end_line = method.source.split("\n").size + start_line - 1 - methods_map << [location.first, test_method, start_line, end_line] + methods_map << [File.expand_path(location.first), test_method, start_line, end_line] end end methods_map diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index f3a43a12db..0f26621b59 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -5,8 +5,8 @@ task default: :test desc "Runs all tests in test folder" task :test do $: << "test" - ARGV.shift if ARGV[0] == "test" - Rails::TestRunner.run(ARGV) + args = ARGV[0] == "test" ? ARGV[1..-1] : [] + Rails::TestRunner.run(args) end namespace :test do diff --git a/railties/railties.gemspec b/railties/railties.gemspec index 5d79325a7a..001882fdc6 100644 --- a/railties/railties.gemspec +++ b/railties/railties.gemspec @@ -28,6 +28,7 @@ Gem::Specification.new do |s| s.add_dependency 'rake', '>= 0.8.7' s.add_dependency 'thor', '>= 0.18.1', '< 2.0' + s.add_dependency 'method_source' s.add_development_dependency 'actionview', version end diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 4c5dd70a88..00a7932267 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -443,13 +443,6 @@ class AppGeneratorTest < Rails::Generators::TestCase end end - def test_inclusion_of_method_source - run_generator - assert_file "Gemfile" do |content| - assert_gem 'method_source' - end - end - def test_template_from_dir_pwd FileUtils.cd(Rails.root) assert_match(/It works from file!/, run_generator([destination_root, "-m", "lib/template.rb"])) diff --git a/railties/test/test_unit/runner_test.rb b/railties/test/test_unit/runner_test.rb index c040c71635..9ea8b2c114 100644 --- a/railties/test/test_unit/runner_test.rb +++ b/railties/test/test_unit/runner_test.rb @@ -41,7 +41,7 @@ class TestUnitTestRunnerTest < ActiveSupport::TestCase test "parse the filename and line" do file = "test/test_unit/runner_test.rb" - absolute_file = __FILE__ + absolute_file = File.expand_path __FILE__ options = @options.parse(["#{file}:20"]) assert_equal absolute_file, options[:filename] assert_equal 20, options[:line] @@ -90,21 +90,22 @@ class TestUnitTestRunnerTest < ActiveSupport::TestCase test "run multiple files and run one file by line" do line = __LINE__ + absolute_file = File.expand_path(__FILE__) options = @options.parse([__dir__, "#{__FILE__}:#{line}"]) assert_equal ["#{__dir__}/**/*_test.rb"], options[:patterns] - assert_equal __FILE__, options[:filename] + assert_equal absolute_file, options[:filename] assert_equal line, options[:line] runner = Rails::TestRunner.new(options) - assert_equal [__FILE__], runner.test_files, 'Only returns the file that running by line' + assert_equal [absolute_file], runner.test_files, 'Only returns the file that running by line' end test "running multiple files passing line number" do line = __LINE__ options = @options.parse(["foobar.rb:8", "#{__FILE__}:#{line}"]) - assert_equal __FILE__, options[:filename], 'Returns the last file' + assert_equal File.expand_path(__FILE__), options[:filename], 'Returns the last file' assert_equal line, options[:line] end end |