2015-12-07 01:16:18 -05:00
|
|
|
require 'generators/plugin_test_helper'
|
|
|
|
|
|
|
|
class TestRunnerInEngineTest < ActiveSupport::TestCase
|
|
|
|
include PluginTestHelper
|
|
|
|
|
|
|
|
def setup
|
|
|
|
@destination_root = Dir.mktmpdir('bukkits')
|
|
|
|
Dir.chdir(@destination_root) { `bundle exec rails plugin new bukkits --full --skip-bundle` }
|
|
|
|
plugin_file 'test/dummy/db/schema.rb', ''
|
|
|
|
end
|
|
|
|
|
|
|
|
def teardown
|
|
|
|
FileUtils.rm_rf(@destination_root)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_rerun_snippet_is_relative_path
|
|
|
|
create_test_file 'post', pass: false
|
|
|
|
|
|
|
|
output = run_test_command('test/post_test.rb')
|
2016-02-15 10:47:51 -05:00
|
|
|
expect = %r{Running:\n\nPostTest\nF\n\nFailure:\nPostTest#test_truth \[[^\]]+test/post_test.rb:6\]:\nwups!\n\nbin/rails test test/post_test.rb:4}
|
2015-12-19 06:04:39 -05:00
|
|
|
assert_match expect, output
|
2015-12-07 01:16:18 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def plugin_path
|
|
|
|
"#{@destination_root}/bukkits"
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_test_command(arguments)
|
|
|
|
Dir.chdir(plugin_path) { `bin/rails test #{arguments}` }
|
|
|
|
end
|
|
|
|
end
|