test_launcher 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/test_launcher/cli/input_parser.rb +0 -2
- data/lib/test_launcher/frameworks.rb +8 -2
- data/lib/test_launcher/frameworks/implementation/collection.rb +9 -0
- data/lib/test_launcher/frameworks/implementation/consolidator.rb +2 -2
- data/lib/test_launcher/frameworks/implementation/locator.rb +27 -11
- data/lib/test_launcher/frameworks/implementation/test_case.rb +0 -5
- data/lib/test_launcher/frameworks/minitest.rb +4 -4
- data/lib/test_launcher/frameworks/rspec.rb +3 -3
- data/lib/test_launcher/version.rb +1 -1
- data/test/install +1 -1
- data/test/test_helper.rb +4 -0
- data/test/test_launcher/minitest_integration_test.rb +17 -12
- data/test/test_launcher/rspec_integration_test.rb +17 -12
- data/test/test_launcher/rubymine_test.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cba086681bd0243f3192c2e8ab7f7c64ecf6c4df
|
4
|
+
data.tar.gz: 2242f9e79779c288404c3928d151ffdbc556af39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 461511ae00c5a6494f0539d55eff8583db0f33eed0728f761f2fd423a343d8458716b53479d1a41d70f4171cd27d93a29952f7cd65dc237b17dcc5b0e883202c
|
7
|
+
data.tar.gz: 4dd2e3d23b03f727d6060a7a6d4e0823bfb0d31d3f8ff1dcf51223fcc5482cfb1a9f1e7bb2f3519ecc0d0f4af1575e9b24d47adbf0ccb5dbd9f4a50059df8185
|
data/README.md
CHANGED
@@ -53,6 +53,14 @@ test_launcher /Users/username/code/my_repo/test/models/blog_post_test.rb
|
|
53
53
|
#=> ruby -I test test/models/blog_post_test.rb
|
54
54
|
```
|
55
55
|
|
56
|
+
But can it run two files for you?
|
57
|
+
```
|
58
|
+
test_launcher blog_post_test.rb comment_test.rb
|
59
|
+
|
60
|
+
#=> ruby -I test test/models/blog_post_test.rb --name=test_blog_name_thing
|
61
|
+
#=> ruby -I test -e 'ARGV.each {|f| require(f)}' test/models/blog_post_test.rb test/models/comment_test.rb
|
62
|
+
```
|
63
|
+
|
56
64
|
### Inline Gems
|
57
65
|
|
58
66
|
Test Launcher will automatically move to the correct subdirectory in order to run the tests. For example, if `thing_test.rb` is within your inline_gem, you can run:
|
@@ -2,16 +2,22 @@ require "test_launcher/frameworks/base"
|
|
2
2
|
require "test_launcher/frameworks/minitest"
|
3
3
|
require "test_launcher/frameworks/rspec"
|
4
4
|
|
5
|
+
class Request < Struct.new(:query, :run_all)
|
6
|
+
end
|
7
|
+
|
5
8
|
module TestLauncher
|
6
9
|
module Frameworks
|
7
10
|
def self.locate(framework_name:, input:, run_all:, shell:, searcher:)
|
11
|
+
|
12
|
+
request = Request.new(input, run_all)
|
13
|
+
|
8
14
|
frameworks = guess_frameworks(framework_name)
|
9
15
|
|
10
16
|
frameworks.each do |framework|
|
11
|
-
search_results = framework::Locator.new(
|
17
|
+
search_results = framework::Locator.new(request, searcher).prioritized_results
|
12
18
|
runner = framework::Runner.new
|
13
19
|
|
14
|
-
command = Implementation::Consolidator.consolidate(search_results, shell, runner
|
20
|
+
command = Implementation::Consolidator.consolidate(search_results, shell, runner)
|
15
21
|
|
16
22
|
return command if command
|
17
23
|
end
|
@@ -6,6 +6,11 @@ module TestLauncher
|
|
6
6
|
class Collection < SimpleDelegator
|
7
7
|
alias :results :__getobj__
|
8
8
|
|
9
|
+
def initialize(results:, run_all:)
|
10
|
+
super(results)
|
11
|
+
@run_all = run_all
|
12
|
+
end
|
13
|
+
|
9
14
|
def file_count
|
10
15
|
results.group_by(&:file).size
|
11
16
|
end
|
@@ -21,6 +26,10 @@ module TestLauncher
|
|
21
26
|
def last_edited
|
22
27
|
results.sort_by(&:mtime).last
|
23
28
|
end
|
29
|
+
|
30
|
+
def run_all?
|
31
|
+
@run_all
|
32
|
+
end
|
24
33
|
end
|
25
34
|
end
|
26
35
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module TestLauncher
|
2
2
|
module Frameworks
|
3
3
|
module Implementation
|
4
|
-
class Consolidator < Struct.new(:search_results, :shell, :runner
|
4
|
+
class Consolidator < Struct.new(:search_results, :shell, :runner)
|
5
5
|
|
6
6
|
def self.consolidate(*args)
|
7
7
|
new(*args).consolidate
|
@@ -50,7 +50,7 @@ module TestLauncher
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def run_last_edited?
|
53
|
-
! run_all
|
53
|
+
! search_results.run_all?
|
54
54
|
end
|
55
55
|
|
56
56
|
def last_edited
|
@@ -4,14 +4,10 @@ require "test_launcher/frameworks/implementation/collection"
|
|
4
4
|
module TestLauncher
|
5
5
|
module Frameworks
|
6
6
|
module Implementation
|
7
|
-
class Locator < Struct.new(:
|
8
|
-
private :
|
7
|
+
class Locator < Struct.new(:request, :searcher)
|
8
|
+
private :request, :searcher
|
9
9
|
|
10
10
|
def prioritized_results
|
11
|
-
Collection.new(_prioritized_results)
|
12
|
-
end
|
13
|
-
|
14
|
-
def _prioritized_results
|
15
11
|
return files_found_by_absolute_path unless files_found_by_absolute_path.empty?
|
16
12
|
|
17
13
|
return examples_found_by_name unless examples_found_by_name.empty?
|
@@ -26,22 +22,42 @@ module TestLauncher
|
|
26
22
|
private
|
27
23
|
|
28
24
|
def files_found_by_absolute_path
|
29
|
-
|
25
|
+
potential_file_paths = request.query.split(" ")
|
26
|
+
return [] unless potential_file_paths.all? {|fp| File.exist?(fp)}
|
30
27
|
|
31
|
-
|
28
|
+
Collection.new(
|
29
|
+
results: potential_file_paths.map {|fp| build_result(file: fp)},
|
30
|
+
run_all: true
|
31
|
+
)
|
32
32
|
end
|
33
33
|
|
34
34
|
def examples_found_by_name
|
35
|
-
@examples_found_by_name ||=
|
35
|
+
@examples_found_by_name ||= Collection.new(
|
36
|
+
results: full_regex_search(regex_pattern).map {|r| build_result(file: r[:file], query: request.query)},
|
37
|
+
run_all: request.run_all
|
38
|
+
)
|
36
39
|
end
|
37
40
|
|
38
41
|
def files_found_by_file_name
|
39
|
-
@files_found_by_file_name ||=
|
42
|
+
@files_found_by_file_name ||= begin
|
43
|
+
potential_file_paths = request.query.split(" ")
|
44
|
+
split_query_results = potential_file_paths.map {|fp| searcher.find_files(fp).select {|f| f.match(file_name_regex) } }
|
45
|
+
|
46
|
+
return [] if split_query_results.any?(&:empty?)
|
47
|
+
|
48
|
+
Collection.new(
|
49
|
+
results: split_query_results.flatten.map {|f| build_result(file: f) },
|
50
|
+
run_all: true,
|
51
|
+
)
|
52
|
+
end
|
40
53
|
end
|
41
54
|
|
42
55
|
def files_found_by_full_regex
|
43
56
|
# we ignore the matched line since we don't know what to do with it
|
44
|
-
@files_found_by_full_regex ||=
|
57
|
+
@files_found_by_full_regex ||= Collection.new(
|
58
|
+
results: full_regex_search(request.query).map {|r| build_result(file: r[:file]) },
|
59
|
+
run_all: request.run_all
|
60
|
+
)
|
45
61
|
end
|
46
62
|
|
47
63
|
def full_regex_search(regex)
|
@@ -32,11 +32,6 @@ module TestLauncher
|
|
32
32
|
File.join(app_root, test_root_folder_name)
|
33
33
|
end
|
34
34
|
|
35
|
-
def relative_test_path
|
36
|
-
path = exploded_path[exploded_path.rindex(test_root_folder_name)..-1]
|
37
|
-
File.join(path)
|
38
|
-
end
|
39
|
-
|
40
35
|
def spring_enabled?
|
41
36
|
return false if ENV['DISABLE_SPRING']
|
42
37
|
|
@@ -18,11 +18,11 @@ module TestLauncher
|
|
18
18
|
"--name=/#{test_case.example}/"
|
19
19
|
end
|
20
20
|
|
21
|
-
%{cd #{test_case.app_root} && #{test_case.runner} #{test_case.
|
21
|
+
%{cd #{test_case.app_root} && #{test_case.runner} #{test_case.file} #{name}}
|
22
22
|
end
|
23
23
|
|
24
24
|
def one_or_more_files(test_cases)
|
25
|
-
%{cd #{test_cases.first.app_root} && #{test_cases.first.runner} #{test_cases.map(&:
|
25
|
+
%{cd #{test_cases.first.app_root} && #{test_cases.first.runner} #{test_cases.map(&:file).join(" ")}}
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -38,7 +38,7 @@ module TestLauncher
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def regex_pattern
|
41
|
-
"^\s*def test_.*#{query.sub(/^test_/, "")}.*"
|
41
|
+
"^\s*def test_.*#{request.query.sub(/^test_/, "")}.*"
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_case_class
|
@@ -54,7 +54,7 @@ module TestLauncher
|
|
54
54
|
elsif is_example?
|
55
55
|
"bundle exec ruby -I test"
|
56
56
|
else
|
57
|
-
"bundle exec ruby -I test -e 'ARGV.each {|f| require(
|
57
|
+
"bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}'"
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -12,11 +12,11 @@ module TestLauncher
|
|
12
12
|
|
13
13
|
class Runner < Base::Runner
|
14
14
|
def single_example(test_case)
|
15
|
-
%{cd #{test_case.app_root} && rspec #{test_case.
|
15
|
+
%{cd #{test_case.app_root} && rspec #{test_case.file} --example #{Shellwords.escape(test_case.example)}}
|
16
16
|
end
|
17
17
|
|
18
18
|
def one_or_more_files(test_cases)
|
19
|
-
%{cd #{test_cases.first.app_root} && rspec #{test_cases.map(&:
|
19
|
+
%{cd #{test_cases.first.app_root} && rspec #{test_cases.map(&:file).join(" ")}}
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -32,7 +32,7 @@ module TestLauncher
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def regex_pattern
|
35
|
-
"^\s*(it|context|(RSpec.)?describe) .*#{query}.* do.*"
|
35
|
+
"^\s*(it|context|(RSpec.)?describe) .*#{request.query}.* do.*"
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_case_class
|
data/test/install
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
gem uninstall -Ix test_launcher && gem build test_launcher.gemspec && gem install test_launcher-
|
3
|
+
gem uninstall -Ix test_launcher && gem build test_launcher.gemspec && gem install test_launcher-`grep -oEi '\d.\d.\d' lib/test_launcher/version.rb`.gem
|
data/test/test_helper.rb
CHANGED
@@ -4,53 +4,58 @@ module TestLauncher
|
|
4
4
|
class MinitestIntegrationTest < TestCase
|
5
5
|
def test__single_method
|
6
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
|
7
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test #{system_path("test/test_launcher/fixtures/minitest/test/class_1_test.rb")} --name=/file_name_1__method_name_1/", Shell::Runner.recall_exec
|
8
8
|
end
|
9
9
|
|
10
10
|
def test__multiple_methods__same_file
|
11
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
|
12
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test #{system_path("test/test_launcher/fixtures/minitest/test/class_1_test.rb")} --name=/file_name_1/", Shell::Runner.recall_exec
|
13
13
|
end
|
14
14
|
|
15
15
|
def test__multiple_methods__different_files
|
16
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
|
17
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test #{system_path("test/test_launcher/fixtures/minitest/test/class_2_test.rb")} --name=/multiple_files__same_method/", Shell::Runner.recall_exec
|
18
18
|
end
|
19
19
|
|
20
20
|
def test__single_file
|
21
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(
|
22
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' #{system_path("test/test_launcher/fixtures/minitest/test/class_1_test.rb")}", Shell::Runner.recall_exec
|
23
23
|
end
|
24
24
|
|
25
25
|
def test__uses_spring
|
26
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
|
27
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest/test/different_root")} && bundle exec spring testunit #{system_path("test/test_launcher/fixtures/minitest/test/different_root/test/different_root_test.rb")}", Shell::Runner.recall_exec
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
30
|
+
def test__multiple_files__found
|
31
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(
|
32
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' #{system_path("test/test_launcher/fixtures/minitest/test/class_2_test.rb")}", Shell::Runner.recall_exec
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def test__multiple_files__found__all
|
36
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(
|
37
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' #{system_path("test/test_launcher/fixtures/minitest/test/class_1_test.rb")} #{system_path("test/test_launcher/fixtures/minitest/test/class_2_test.rb")}", Shell::Runner.recall_exec
|
38
|
+
end
|
39
|
+
|
40
|
+
def test__multiple_file_paths
|
41
|
+
TestLauncher.launch("class_1_tes""t.rb class_2_test.rb", framework: "minitest") # don't trigger the find in *this* file
|
42
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' #{system_path("test/test_launcher/fixtures/minitest/test/class_1_test.rb")} #{system_path("test/test_launcher/fixtures/minitest/test/class_2_test.rb")}", Shell::Runner.recall_exec
|
38
43
|
end
|
39
44
|
|
40
45
|
def test__multiple_files__different_roots__all
|
41
46
|
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(
|
47
|
+
expected = "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' #{system_path("test/test_launcher/fixtures/minitest/test/class_1_test.rb")} #{system_path("test/test_launcher/fixtures/minitest/test/class_2_test.rb")}; cd -;\n\ncd #{system_path("test/test_launcher/fixtures/minitest/test/different_root")} && bundle exec spring testunit #{system_path("test/test_launcher/fixtures/minitest/test/different_root/test/different_root_test.rb")}"
|
43
48
|
assert_equal expected, Shell::Runner.recall_exec
|
44
49
|
end
|
45
50
|
|
46
51
|
def test__regex
|
47
52
|
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(
|
53
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' #{system_path("test/test_launcher/fixtures/minitest/test/class_1_test.rb")}", Shell::Runner.recall_exec
|
49
54
|
end
|
50
55
|
|
51
56
|
def test__regex__does_not_test_helper__methods
|
52
57
|
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(
|
58
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/minitest")} && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' #{system_path("test/test_launcher/fixtures/minitest/test/class_1_test.rb")}", Shell::Runner.recall_exec
|
54
59
|
end
|
55
60
|
|
56
61
|
def test__not_found
|
@@ -4,53 +4,58 @@ module TestLauncher
|
|
4
4
|
class RspecIntegrationTest < TestCase
|
5
5
|
def test__single_method
|
6
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
|
7
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/class_1_spec.rb")} --example file_name_1\\ example_name_1", Shell::Runner.recall_exec
|
8
8
|
end
|
9
9
|
|
10
10
|
def test__single_context
|
11
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
|
12
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/class_1_spec.rb")} --example file_name_1\\ context_1", Shell::Runner.recall_exec
|
13
13
|
end
|
14
14
|
|
15
15
|
def test__single_describe
|
16
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
|
17
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/class_1_spec.rb")} --example Root1DummyTes""tClass1", Shell::Runner.recall_exec
|
18
18
|
end
|
19
19
|
|
20
20
|
def test__multiple_methods__same_file
|
21
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
|
22
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/class_1_spec.rb")} --example file_name_1", Shell::Runner.recall_exec
|
23
23
|
end
|
24
24
|
|
25
25
|
def test__multiple_methods__different_files
|
26
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
|
27
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/class_2_spec.rb")} --example multiple_files\\ same_example", Shell::Runner.recall_exec
|
28
28
|
end
|
29
29
|
|
30
30
|
def test__single_file
|
31
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
|
32
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/class_1_spec.rb")}", Shell::Runner.recall_exec
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def test__multiple_files__found
|
36
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
|
37
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/class_2_spec.rb")} --example Roo""t1", Shell::Runner.recall_exec
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
40
|
+
def test__multiple_files__found__all
|
41
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
|
42
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/class_1_spec.rb")} #{system_path("test/test_launcher/fixtures/rspec/spec/class_2_spec.rb")}", Shell::Runner.recall_exec
|
43
|
+
end
|
44
|
+
|
45
|
+
def test__multiple_file_paths
|
46
|
+
TestLauncher.launch("class_1_spec.rb class_2_spec.rb", framework: "rspec") # don't trigger the find in *this* file
|
47
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/class_1_spec.rb")} #{system_path("test/test_launcher/fixtures/rspec/spec/class_2_spec.rb")}", Shell::Runner.recall_exec
|
43
48
|
end
|
44
49
|
|
45
50
|
def test__multiple_files__different_roots__all
|
46
51
|
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/
|
52
|
+
expected = "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/class_1_spec.rb")} #{system_path("test/test_launcher/fixtures/rspec/spec/class_2_spec.rb")}; cd -;\n\ncd #{system_path("test/test_launcher/fixtures/rspec/spec/different_root")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/different_root/spec/different_root_spec.rb")}"
|
48
53
|
assert_equal expected, Shell::Runner.recall_exec
|
49
54
|
end
|
50
55
|
|
51
56
|
def test__regex
|
52
57
|
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
|
58
|
+
assert_equal "cd #{system_path("test/test_launcher/fixtures/rspec")} && rspec #{system_path("test/test_launcher/fixtures/rspec/spec/class_2_spec.rb")}", Shell::Runner.recall_exec
|
54
59
|
end
|
55
60
|
|
56
61
|
def test__not_found
|
@@ -5,14 +5,14 @@ module TestLauncher
|
|
5
5
|
class RubymineTest < TestCase
|
6
6
|
def test_launch__run__file
|
7
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(
|
8
|
+
expected_command = "cd /Users/username/some_app/engines/some_engine && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' /Users/username/some_app/engines/some_engine/test/does_something_test.rb"
|
9
9
|
|
10
10
|
assert_executes expected_command, args
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_launch__run__example
|
14
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"
|
15
|
+
expected_command = "cd /Users/username/some_app/engines/some_engine && bundle exec ruby -I test /Users/username/some_app/engines/some_engine/test/does_something_test.rb --name=some_test_name"
|
16
16
|
|
17
17
|
assert_executes expected_command, args
|
18
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_launcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Kinnecom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|