diff options
Diffstat (limited to 'railties/test/generators/plugin_test_runner_test.rb')
-rw-r--r-- | railties/test/generators/plugin_test_runner_test.rb | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/railties/test/generators/plugin_test_runner_test.rb b/railties/test/generators/plugin_test_runner_test.rb index 0887afd0db..716728819e 100644 --- a/railties/test/generators/plugin_test_runner_test.rb +++ b/railties/test/generators/plugin_test_runner_test.rb @@ -1,7 +1,8 @@ -require 'tmpdir' -require 'abstract_unit' +require 'generators/plugin_test_helper' class PluginTestRunnerTest < ActiveSupport::TestCase + include PluginTestHelper + def setup @destination_root = Dir.mktmpdir('bukkits') Dir.chdir(@destination_root) { `bundle exec rails plugin new bukkits --skip-bundle` } @@ -70,7 +71,7 @@ class PluginTestRunnerTest < ActiveSupport::TestCase create_test_file 'post', pass: false output = run_test_command('test/post_test.rb') - assert_match %r{Running:\n\nPostTest\nF\n\nwups!\n\nbin/test #{plugin_path}/test/post_test.rb:6}, output + assert_match %r{Running:\n\nPostTest\nF\n\nwups!\n\nbin/test (/private)?#{plugin_path}/test/post_test.rb:6}, output end def test_only_inline_failure_output @@ -100,24 +101,4 @@ class PluginTestRunnerTest < ActiveSupport::TestCase def run_test_command(arguments) Dir.chdir(plugin_path) { `bin/test #{arguments}` } end - - def create_test_file(name, pass: true) - plugin_file "test/#{name}_test.rb", <<-RUBY - require 'test_helper' - - class #{name.camelize}Test < ActiveSupport::TestCase - def test_truth - puts "#{name.camelize}Test" - assert #{pass}, 'wups!' - end - end - RUBY - end - - def plugin_file(path, contents, mode: 'w') - FileUtils.mkdir_p File.dirname("#{plugin_path}/#{path}") - File.open("#{plugin_path}/#{path}", mode) do |f| - f.puts contents - end - end end |