test_launcher 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +101 -18
- data/Rakefile +6 -0
- data/bin/test_launcher +8 -35
- data/lib/test_launcher.rb +22 -0
- data/lib/test_launcher/cli/input_parser.rb +73 -0
- data/lib/test_launcher/frameworks.rb +32 -0
- data/lib/test_launcher/frameworks/base.rb +54 -0
- data/lib/test_launcher/frameworks/implementation/collection.rb +27 -0
- data/lib/test_launcher/{tests/minitest → frameworks/implementation}/consolidator.rb +30 -32
- data/lib/test_launcher/frameworks/implementation/locator.rb +74 -0
- data/lib/test_launcher/frameworks/implementation/test_case.rb +65 -0
- data/lib/test_launcher/frameworks/minitest.rb +67 -0
- data/lib/test_launcher/frameworks/rspec.rb +50 -0
- data/lib/test_launcher/rubymine.rb +26 -0
- data/lib/test_launcher/rubymine/launcher.rb +55 -0
- data/lib/test_launcher/search/git.rb +64 -0
- data/lib/test_launcher/shell/runner.rb +19 -22
- data/lib/test_launcher/version.rb +1 -1
- data/test/install +3 -0
- data/test/test_helper.rb +32 -17
- data/test/test_launcher/fixtures/minitest/test/class_1_test.rb +17 -0
- data/test/test_launcher/fixtures/minitest/test/class_2_test.rb +5 -0
- data/test/test_launcher/fixtures/minitest/test/different_root/bin/spring +1 -0
- data/test/test_launcher/fixtures/minitest/test/different_root/test/different_root_test.rb +2 -0
- data/test/test_launcher/fixtures/rspec/spec/class_1_spec.rb +16 -0
- data/test/test_launcher/fixtures/rspec/spec/class_2_spec.rb +6 -0
- data/test/test_launcher/fixtures/rspec/spec/different_root/spec/different_root_spec.rb +2 -0
- data/test/test_launcher/minitest_integration_test.rb +67 -0
- data/test/test_launcher/rspec_integration_test.rb +67 -0
- data/test/test_launcher/rubymine_test.rb +48 -0
- data/test_launcher.gemspec +2 -3
- metadata +39 -44
- data/bin/test_runner +0 -1
- data/lib/test_launcher/searchers/git_searcher.rb +0 -38
- data/lib/test_launcher/tests/minitest/finder.rb +0 -50
- data/lib/test_launcher/tests/minitest/wrappers/multiple_files.rb +0 -23
- data/lib/test_launcher/tests/minitest/wrappers/multiple_roots.rb +0 -23
- data/lib/test_launcher/tests/minitest/wrappers/single_file.rb +0 -29
- data/lib/test_launcher/tests/minitest/wrappers/single_root.rb +0 -27
- data/lib/test_launcher/tests/minitest/wrappers/single_test.rb +0 -37
- data/lib/test_launcher/utils/path.rb +0 -32
- data/lib/test_launcher/utils/pluralize.rb +0 -14
- data/test/test_launcher/searchers/git_searcher_test.rb +0 -50
- data/test/test_launcher/tests/minitest/consolidator_integration_test.rb +0 -191
- data/test/test_launcher/tests/minitest/finder_test.rb +0 -71
@@ -0,0 +1,64 @@
|
|
1
|
+
module TestLauncher
|
2
|
+
module Searchers
|
3
|
+
class Git
|
4
|
+
|
5
|
+
def self.valid?
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(shell)
|
10
|
+
@shell = shell
|
11
|
+
Dir.chdir(root_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def find_files(pattern)
|
15
|
+
shell.run("git ls-files '*#{pattern}*'").map {|f| system_path(f)}
|
16
|
+
end
|
17
|
+
|
18
|
+
def grep(regex, file_pattern: '*')
|
19
|
+
results = shell.run("git grep --untracked --extended-regexp '#{regex}' -- '#{file_pattern}'")
|
20
|
+
results.map do |result|
|
21
|
+
interpret_grep_result(result)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def interpret_grep_result(grep_result)
|
28
|
+
splits = grep_result.split(/:/)
|
29
|
+
file = splits.shift.strip
|
30
|
+
# we rejoin on ':' because our
|
31
|
+
# code may have colons inside of it.
|
32
|
+
#
|
33
|
+
# example:
|
34
|
+
# path/to/file: run_method(a: A, b: B)
|
35
|
+
#
|
36
|
+
# so shift the first one out, then
|
37
|
+
# rejoin the rest
|
38
|
+
line = splits.join(':').strip
|
39
|
+
|
40
|
+
{
|
41
|
+
:file => system_path(file),
|
42
|
+
:line => line,
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def system_path(file)
|
47
|
+
File.join(root_path, file)
|
48
|
+
end
|
49
|
+
|
50
|
+
def root_path
|
51
|
+
@root_path ||= %x[ git rev-parse --show-toplevel ].chomp.tap do
|
52
|
+
if $? != 0
|
53
|
+
shell.warn "test_launcher must be used in a git repository"
|
54
|
+
exit
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def shell
|
60
|
+
@shell
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "test_launcher/shell/color"
|
2
|
-
require "
|
2
|
+
require "bundler"
|
3
3
|
|
4
4
|
module TestLauncher
|
5
5
|
module Shell
|
@@ -8,53 +8,50 @@ module TestLauncher
|
|
8
8
|
|
9
9
|
CommandFailureError = Class.new(StandardError)
|
10
10
|
|
11
|
-
attr_accessor :
|
12
|
-
private :
|
11
|
+
attr_accessor :log_path, :queue
|
12
|
+
private :log_path, :queue
|
13
13
|
|
14
|
-
def initialize(log_path
|
15
|
-
@working_directory = working_directory
|
14
|
+
def initialize(log_path:)
|
16
15
|
@log_path = log_path
|
17
|
-
|
18
16
|
%x{echo "" > #{log_path}}
|
19
|
-
Dir.chdir(%x[ git rev-parse --show-toplevel ].chomp)
|
20
17
|
end
|
21
18
|
|
22
|
-
def run(cmd, dir:
|
23
|
-
command = "cd #{
|
24
|
-
|
19
|
+
def run(cmd, dir: ".")
|
20
|
+
command = "cd #{dir} && #{cmd}"
|
21
|
+
log(command)
|
25
22
|
|
26
23
|
shell_out(command).split("\n")
|
27
24
|
end
|
28
25
|
|
29
26
|
def exec(cmd)
|
30
27
|
notify cmd
|
31
|
-
|
28
|
+
Bundler.clean_exec(cmd)
|
32
29
|
end
|
33
30
|
|
34
31
|
def warn(msg)
|
35
|
-
log msg
|
36
|
-
print "#{red(msg
|
32
|
+
log msg
|
33
|
+
print "#{red(msg)}\n"
|
37
34
|
end
|
38
35
|
|
39
36
|
def notify(msg)
|
40
|
-
log msg
|
41
|
-
print "#{yellow(msg
|
37
|
+
log msg
|
38
|
+
print "#{yellow(msg)}\n"
|
39
|
+
end
|
40
|
+
|
41
|
+
def puts(msg)
|
42
|
+
log msg
|
43
|
+
print "#{msg}\n"
|
42
44
|
end
|
43
45
|
|
44
46
|
def confirm?(question)
|
45
47
|
warn "#{question} [Yn]"
|
46
|
-
|
47
|
-
return answer != 'n'
|
48
|
+
STDIN.gets.strip.downcase != 'n'
|
48
49
|
end
|
49
50
|
|
50
51
|
private
|
51
52
|
|
52
53
|
def log(msg)
|
53
|
-
%x{echo "#{msg
|
54
|
-
end
|
55
|
-
|
56
|
-
def handle_output_for(cmd)
|
57
|
-
log(cmd)
|
54
|
+
%x{echo "#{msg}" >> #{log_path}}
|
58
55
|
end
|
59
56
|
|
60
57
|
def shell_out(command)
|
data/test/install
ADDED
data/test/test_helper.rb
CHANGED
@@ -1,8 +1,40 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.join(File.split(File.dirname(__FILE__))[0], 'lib'))
|
2
2
|
require "minitest/autorun"
|
3
3
|
require "mocha/mini_test"
|
4
|
+
require "pry"
|
5
|
+
|
6
|
+
require "test_launcher"
|
7
|
+
|
8
|
+
class TestLauncher::Shell::Runner
|
9
|
+
def exec(cmd)
|
10
|
+
raise "execed twice" if defined?(@exec)
|
11
|
+
@@exec = cmd
|
12
|
+
end
|
13
|
+
|
14
|
+
def notify(*)
|
15
|
+
# silence logs during test
|
16
|
+
end
|
17
|
+
|
18
|
+
def warn(*)
|
19
|
+
# silence logs during test
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.recall_exec
|
23
|
+
return unless @@exec
|
24
|
+
@@exec.to_s
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.reset
|
28
|
+
@@exec = nil
|
29
|
+
end
|
30
|
+
end
|
4
31
|
|
5
32
|
class TestCase < Minitest::Test
|
33
|
+
|
34
|
+
def setup
|
35
|
+
TestLauncher::Shell::Runner.reset
|
36
|
+
end
|
37
|
+
|
6
38
|
class DummyShell
|
7
39
|
|
8
40
|
def method_missing(method, *args)
|
@@ -20,23 +52,6 @@ class TestCase < Minitest::Test
|
|
20
52
|
end
|
21
53
|
end
|
22
54
|
|
23
|
-
def assert_notified(string)
|
24
|
-
unless dummy_shell.recall(:notify).flatten.include?(string)
|
25
|
-
flunk <<-FLUNK
|
26
|
-
could not find: "#{string}"
|
27
|
-
shell.notify called with:
|
28
|
-
#{dummy_shell.recall(:notify)}
|
29
|
-
FLUNK
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def assert_paragraphs_equal(expected, actual)
|
34
|
-
expecteds = expected.split("\n").map {|l| l.to_s.strip}
|
35
|
-
actuals = actual.split("\n").map {|l| l.to_s.strip}
|
36
|
-
|
37
|
-
assert_equal expecteds, actuals
|
38
|
-
end
|
39
|
-
|
40
55
|
private
|
41
56
|
|
42
57
|
def dummy_shell
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Root1DummyTestClass1Test
|
2
|
+
def test__file_name_1__method_name_1
|
3
|
+
test_unit_test_method_body
|
4
|
+
end
|
5
|
+
|
6
|
+
def test__file_name_1__method_name_2
|
7
|
+
test_unit_test_method_body
|
8
|
+
end
|
9
|
+
|
10
|
+
def test__multiple_files__same_method
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def helper_method
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# stub to indicate that spring is active in this root
|
@@ -0,0 +1,16 @@
|
|
1
|
+
describe Root1DummyTestClass1 do
|
2
|
+
|
3
|
+
context "file_name_1 context_1" do
|
4
|
+
it "file_name_1 example_name_1 '\" " do
|
5
|
+
test_unit_test_method_body
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'file_name_1 example_name_2' do
|
9
|
+
test_unit_test_method_body
|
10
|
+
end
|
11
|
+
|
12
|
+
it "multiple_files same_example" do
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
module TestLauncher
|
4
|
+
class MinitestIntegrationTest < TestCase
|
5
|
+
def test__single_method
|
6
|
+
TestLauncher.launch("file_name_1__method_name_1", framework: "minitest")
|
7
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test test/class_1_test.rb --name=/file_name_1__method_name_1/", Shell::Runner.recall_exec
|
8
|
+
end
|
9
|
+
|
10
|
+
def test__multiple_methods__same_file
|
11
|
+
TestLauncher.launch("file_name_1", framework: "minitest")
|
12
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test test/class_1_test.rb --name=/file_name_1/", Shell::Runner.recall_exec
|
13
|
+
end
|
14
|
+
|
15
|
+
def test__multiple_methods__different_files
|
16
|
+
TestLauncher.launch("multiple_files__same_method", framework: "minitest")
|
17
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test test/class_2_test.rb --name=/multiple_files__same_method/", Shell::Runner.recall_exec
|
18
|
+
end
|
19
|
+
|
20
|
+
def test__single_file
|
21
|
+
TestLauncher.launch("class_1_test", framework: "minitest")
|
22
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(File.join(Dir.pwd, f))}' test/class_1_test.rb", Shell::Runner.recall_exec
|
23
|
+
end
|
24
|
+
|
25
|
+
def test__uses_spring
|
26
|
+
TestLauncher.launch("different_roo""t_test", framework: "minitest") # don't trigger the find in *this* file
|
27
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest/test/different_root")} && bundle exec spring testunit test/different_root_test.rb", Shell::Runner.recall_exec
|
28
|
+
end
|
29
|
+
|
30
|
+
def test__multiple_files
|
31
|
+
TestLauncher.launch("Root1""Dum""myTest""Class", framework: "minitest") # don't trigger the find in *this* file
|
32
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(File.join(Dir.pwd, f))}' test/class_2_test.rb", Shell::Runner.recall_exec
|
33
|
+
end
|
34
|
+
|
35
|
+
def test__multiple_files__all
|
36
|
+
TestLauncher.launch("Root1""DummyTest""Class", run_all: true, framework: "minitest") # don't trigger the find in *this* file
|
37
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(File.join(Dir.pwd, f))}' test/class_1_test.rb test/class_2_test.rb", Shell::Runner.recall_exec
|
38
|
+
end
|
39
|
+
|
40
|
+
def test__multiple_files__different_roots__all
|
41
|
+
TestLauncher.launch("DummyTest""Class", run_all: true, framework: "minitest") # don't trigger the find in *this* file
|
42
|
+
expected = "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(File.join(Dir.pwd, f))}' test/class_1_test.rb test/class_2_test.rb; cd -;\n\ncd #{system_path("test/test_launcher/fixtures/minitest/test/different_root")} && bundle exec spring testunit test/different_root_test.rb"
|
43
|
+
assert_equal expected, Shell::Runner.recall_exec
|
44
|
+
end
|
45
|
+
|
46
|
+
def test__regex
|
47
|
+
TestLauncher.launch("Root1""DummyTest""Class1""Test", framework: "minitest") # don't trigger the find in *this* file
|
48
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(File.join(Dir.pwd, f))}' test/class_1_test.rb", Shell::Runner.recall_exec
|
49
|
+
end
|
50
|
+
|
51
|
+
def test__regex__does_not_test_helper__methods
|
52
|
+
TestLauncher.launch("helper_meth""od", framework: "minitest") # don't trigger the find in *this* file
|
53
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(File.join(Dir.pwd, f))}' test/class_1_test.rb", Shell::Runner.recall_exec
|
54
|
+
end
|
55
|
+
|
56
|
+
def test__not_found
|
57
|
+
TestLauncher.launch("not_found""thing", framework: "minitest")
|
58
|
+
assert_equal nil, Shell::Runner.recall_exec
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def system_path(relative_dir)
|
64
|
+
File.join(Dir.pwd, relative_dir)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
module TestLauncher
|
4
|
+
class RspecIntegrationTest < TestCase
|
5
|
+
def test__single_method
|
6
|
+
TestLauncher.launch("file_name_1 example_name_""1", framework: "rspec")
|
7
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec spec/class_1_spec.rb --example file_name_1\\ example_name_1", Shell::Runner.recall_exec
|
8
|
+
end
|
9
|
+
|
10
|
+
def test__single_context
|
11
|
+
TestLauncher.launch("file_name_1 con""text_1", framework: "rspec")
|
12
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec spec/class_1_spec.rb --example file_name_1\\ context_1", Shell::Runner.recall_exec
|
13
|
+
end
|
14
|
+
|
15
|
+
def test__single_describe
|
16
|
+
TestLauncher.launch("Root1DummyTes""tClass1", framework: "rspec")
|
17
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec spec/class_1_spec.rb --example Root1DummyTes""tClass1", Shell::Runner.recall_exec
|
18
|
+
end
|
19
|
+
|
20
|
+
def test__multiple_methods__same_file
|
21
|
+
TestLauncher.launch("file_name_1", framework: "rspec")
|
22
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec spec/class_1_spec.rb --example file_name_1", Shell::Runner.recall_exec
|
23
|
+
end
|
24
|
+
|
25
|
+
def test__multiple_methods__different_files
|
26
|
+
TestLauncher.launch("multiple_files same_example", framework: "rspec")
|
27
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec spec/class_2_spec.rb --example multiple_files\\ same_example", Shell::Runner.recall_exec
|
28
|
+
end
|
29
|
+
|
30
|
+
def test__single_file
|
31
|
+
TestLauncher.launch("class_1_spec", framework: "rspec")
|
32
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec spec/class_1_spec.rb", Shell::Runner.recall_exec
|
33
|
+
end
|
34
|
+
|
35
|
+
def test__multiple_files
|
36
|
+
TestLauncher.launch("Root1", framework: "rspec") # don't trigger the find in *this* file
|
37
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec spec/class_2_spec.rb --example Roo""t1", Shell::Runner.recall_exec
|
38
|
+
end
|
39
|
+
|
40
|
+
def test__multiple_files__all
|
41
|
+
TestLauncher.launch("Root1""DummyTest""Class", run_all: true, framework: "rspec") # don't trigger the find in *this* file
|
42
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec spec/class_1_spec.rb spec/class_2_spec.rb", Shell::Runner.recall_exec
|
43
|
+
end
|
44
|
+
|
45
|
+
def test__multiple_files__different_roots__all
|
46
|
+
TestLauncher.launch("DummyTest""Class", run_all: true, framework: "rspec") # don't trigger the find in *this* file
|
47
|
+
expected = "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec spec/class_1_spec.rb spec/class_2_spec.rb; cd -;\n\ncd #{system_path("test/test_launcher/fixtures/rspe")}c/spec/different_root && rspec spec/different_root_spec.rb"
|
48
|
+
assert_equal expected, Shell::Runner.recall_exec
|
49
|
+
end
|
50
|
+
|
51
|
+
def test__regex
|
52
|
+
TestLauncher.launch("a_test_that_u""ses", framework: "rspec") # don't trigger the find in *this* file
|
53
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec spec/class_2_spec.rb", Shell::Runner.recall_exec
|
54
|
+
end
|
55
|
+
|
56
|
+
def test__not_found
|
57
|
+
TestLauncher.launch("not_found""thing", framework: "minitest")
|
58
|
+
assert_equal nil, Shell::Runner.recall_exec
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def system_path(relative_dir)
|
64
|
+
File.join(Dir.pwd, relative_dir)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require "test_launcher/rubymine/launcher"
|
3
|
+
|
4
|
+
module TestLauncher
|
5
|
+
class RubymineTest < TestCase
|
6
|
+
def test_launch__run__file
|
7
|
+
args = "/Users/username/some_app/bin/spring testunit /Users/username/some_app/engines/some_engine/test/does_something_test.rb"
|
8
|
+
expected_command = "cd /Users/username/some_app/engines/some_engine && bundle exec ruby -I test -e 'ARGV.each {|f| require(File.join(Dir.pwd, f))}' test/does_something_test.rb"
|
9
|
+
|
10
|
+
assert_executes expected_command, args
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_launch__run__example
|
14
|
+
args = "/Users/username/some_app/bin/spring testunit /Users/username/some_app/engines/some_engine/test/does_something_test.rb --name=some_test_name"
|
15
|
+
expected_command = "cd /Users/username/some_app/engines/some_engine && bundle exec ruby -I test test/does_something_test.rb --name=some_test_name"
|
16
|
+
|
17
|
+
assert_executes expected_command, args
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_launch__debug__example
|
21
|
+
args = "/Users/username/.rvm/gems/ruby-2.2.3/gems/ruby-debug-ide-0.6.1.beta2/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 58930 --host 0.0.0.0 --dispatcher-port 58931 -- /Users/username/some_app/bin/spring testunit /Users/username/some_app/engines/some_engine/test/does_something_test.rb --name=some_test_name"
|
22
|
+
expected_command = "cd /Users/username/some_app/engines/some_engine && ruby -I test /Users/username/.rvm/gems/ruby-2.2.3/gems/ruby-debug-ide-0.6.1.beta2/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 58930 --host 0.0.0.0 --dispatcher-port 58931 -- /Users/username/some_app/bin/spring testunit /Users/username/some_app/engines/some_engine/test/does_something_test.rb --name=some_test_name"
|
23
|
+
|
24
|
+
assert_executes(expected_command, args)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_launch__debug__file
|
28
|
+
args = "/Users/username/.rvm/gems/ruby-2.2.3/gems/ruby-debug-ide-0.6.1.beta2/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 58930 --host 0.0.0.0 --dispatcher-port 58931 -- /Users/username/some_app/bin/spring testunit /Users/username/some_app/engines/some_engine/test/does_something_test.rb"
|
29
|
+
expected_command = "cd /Users/username/some_app/engines/some_engine && ruby -I test /Users/username/.rvm/gems/ruby-2.2.3/gems/ruby-debug-ide-0.6.1.beta2/bin/rdebug-ide --disable-int-handler --evaluation-timeout 10 --rubymine-protocol-extensions --port 58930 --host 0.0.0.0 --dispatcher-port 58931 -- /Users/username/some_app/bin/spring testunit /Users/username/some_app/engines/some_engine/test/does_something_test.rb"
|
30
|
+
|
31
|
+
assert_executes(expected_command, args)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def assert_executes(expected_command, args)
|
37
|
+
launcher = Rubymine::Launcher.new(
|
38
|
+
args: args.split(" "),
|
39
|
+
shell: dummy_shell
|
40
|
+
)
|
41
|
+
|
42
|
+
launcher.launch
|
43
|
+
assert_equal 1, dummy_shell.recall(:exec).size
|
44
|
+
assert_equal [[expected_command]], dummy_shell.recall(:exec)
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|