test_launcher 1.5.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +81 -37
  3. data/lib/test_launcher/cli.rb +1 -3
  4. data/lib/test_launcher/cli/input_parser.rb +10 -6
  5. data/lib/test_launcher/frameworks/base.rb +11 -0
  6. data/lib/test_launcher/frameworks/{elixir.rb → ex_unit.rb} +16 -20
  7. data/lib/test_launcher/frameworks/minitest.rb +29 -17
  8. data/lib/test_launcher/frameworks/rspec.rb +14 -7
  9. data/lib/test_launcher/queries.rb +47 -31
  10. data/lib/test_launcher/shell/runner.rb +2 -1
  11. data/lib/test_launcher/version.rb +1 -1
  12. data/test/test_helpers/integration_helper.rb +6 -13
  13. data/test/test_helpers/mocks.rb +1 -0
  14. data/test/test_helpers/mocks/searcher_mock.rb +3 -1
  15. data/test/test_launcher/ex_unit_integration_test.rb +392 -0
  16. data/test/test_launcher/fixtures/minitest/test/class_1_test.rb +4 -15
  17. data/test/test_launcher/fixtures/minitest/test/class_2_test.rb +7 -3
  18. data/test/test_launcher/frameworks/minitest/runner_test.rb +10 -10
  19. data/test/test_launcher/frameworks/minitest/searcher_test.rb +11 -10
  20. data/test/test_launcher/frameworks/rspec/runner_test.rb +5 -5
  21. data/test/test_launcher/frameworks/rspec/searcher_test.rb +4 -4
  22. data/test/test_launcher/minitest_integration_test.rb +533 -38
  23. data/test/test_launcher/queries/example_name_query_test.rb +5 -1
  24. data/test/test_launcher/queries/line_number_query_test.rb +7 -7
  25. data/test/test_launcher/queries/multi_term_query_test.rb +0 -12
  26. data/test/test_launcher/rspec_integration_test.rb +458 -35
  27. metadata +5 -5
  28. data/test/test_launcher/queries/specified_name_query_test.rb +0 -112
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.5.2
4
+ version: 2.0.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: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,7 +59,7 @@ files:
59
59
  - lib/test_launcher/cli/query.rb
60
60
  - lib/test_launcher/cli/request.rb
61
61
  - lib/test_launcher/frameworks/base.rb
62
- - lib/test_launcher/frameworks/elixir.rb
62
+ - lib/test_launcher/frameworks/ex_unit.rb
63
63
  - lib/test_launcher/frameworks/implementation/test_case.rb
64
64
  - lib/test_launcher/frameworks/minitest.rb
65
65
  - lib/test_launcher/frameworks/rspec.rb
@@ -81,6 +81,7 @@ files:
81
81
  - test/test_helpers/mocks.rb
82
82
  - test/test_helpers/mocks/searcher_mock.rb
83
83
  - test/test_launcher/cli/input_parser_test.rb
84
+ - test/test_launcher/ex_unit_integration_test.rb
84
85
  - test/test_launcher/fixtures/minitest/Gemfile
85
86
  - test/test_launcher/fixtures/minitest/test/class_1_test.rb
86
87
  - test/test_launcher/fixtures/minitest/test/class_2_test.rb
@@ -106,7 +107,6 @@ files:
106
107
  - test/test_launcher/queries/path_query_test.rb
107
108
  - test/test_launcher/queries/search_query_test.rb
108
109
  - test/test_launcher/queries/single_term_query_test.rb
109
- - test/test_launcher/queries/specified_name_query_test.rb
110
110
  - test/test_launcher/rspec_integration_test.rb
111
111
  - test/test_launcher/rubymine_test.rb
112
112
  - test/test_launcher/search/git_test.rb
@@ -144,6 +144,7 @@ test_files:
144
144
  - test/test_helpers/mocks.rb
145
145
  - test/test_helpers/mocks/searcher_mock.rb
146
146
  - test/test_launcher/cli/input_parser_test.rb
147
+ - test/test_launcher/ex_unit_integration_test.rb
147
148
  - test/test_launcher/fixtures/minitest/Gemfile
148
149
  - test/test_launcher/fixtures/minitest/test/class_1_test.rb
149
150
  - test/test_launcher/fixtures/minitest/test/class_2_test.rb
@@ -169,7 +170,6 @@ test_files:
169
170
  - test/test_launcher/queries/path_query_test.rb
170
171
  - test/test_launcher/queries/search_query_test.rb
171
172
  - test/test_launcher/queries/single_term_query_test.rb
172
- - test/test_launcher/queries/specified_name_query_test.rb
173
173
  - test/test_launcher/rspec_integration_test.rb
174
174
  - test/test_launcher/rubymine_test.rb
175
175
  - test/test_launcher/search/git_test.rb
@@ -1,112 +0,0 @@
1
- require "test_helper"
2
- require "test_helpers/mocks"
3
- require "test_launcher/queries"
4
-
5
- module TestLauncher
6
- module Queries
7
- class SpecifiedNameQueryTest < TestCase
8
- include DefaultMocks
9
-
10
- def searcher
11
- @searcher ||= MockSearcher.new do |m|
12
- m.impl :test_files do |search_string|
13
- case search_string
14
- when "not_found"
15
- []
16
- when "multiple_matches"
17
- ["file_1", "file_2"]
18
- when "exact_match"
19
- ["matched_file.rb"]
20
- else
21
- raise "can't find #{search_string}"
22
- end
23
- end
24
- end
25
- end
26
-
27
- def test_command__file_not_found__returns_no_command
28
- request = MockRequest.new(
29
- search_string: "not_found",
30
- shell: default_shell,
31
- searcher: searcher
32
- )
33
- query = SpecifiedNameQuery.new(request, MockCommandFinder.new)
34
-
35
- assert_equal nil, query.command
36
- end
37
-
38
- def test_command__file_not_found__warns
39
- request = MockRequest.new(
40
- search_string: "not_found",
41
- shell: default_shell,
42
- searcher: searcher
43
- )
44
- SpecifiedNameQuery.new(request, MockCommandFinder.new).command
45
-
46
- assert_equal 1, default_shell.recall(:warn).size
47
- end
48
-
49
- def test_command__multiple_files_found
50
- request = MockRequest.new(
51
- search_string: "multiple_matches",
52
- shell: default_shell,
53
- searcher: searcher
54
- )
55
- query = SpecifiedNameQuery.new(request, MockCommandFinder.new)
56
-
57
- assert_equal nil, query.command
58
- end
59
-
60
- def test_command__multiple_files_found__warns
61
- request = MockRequest.new(
62
- search_string: "multiple_matches",
63
- shell: default_shell,
64
- searcher: searcher
65
- )
66
- SpecifiedNameQuery.new(request, MockCommandFinder.new).command
67
-
68
- assert_equal 1, default_shell.recall(:warn).size
69
- end
70
-
71
- def test_command__exact_match__command_is_single_example
72
- request = MockRequest.new(
73
- search_string: "exact_match",
74
- example_name: "example_name",
75
- test_case: default_test_case,
76
- shell: default_shell,
77
- runner: default_runner,
78
- searcher: searcher
79
- ) do |m|
80
- m.impl(:test_case) { default_test_case }
81
- end # TODO: hack while implementing new searcher mocking
82
- command = SpecifiedNameQuery.new(request, MockCommandFinder.new).command
83
-
84
- expected_runner_args = [
85
- default_test_case,
86
- ]
87
- assert_includes default_runner.recall(:single_example), expected_runner_args
88
- assert_equal "single_example_return", command
89
- end
90
-
91
- def test_command__exact_match__creates_example_test_case
92
- request = MockRequest.new(
93
- search_string: "exact_match",
94
- example_name: "example_name",
95
- test_case: default_test_case,
96
- shell: default_shell,
97
- runner: default_runner,
98
- searcher: searcher
99
- )
100
- command = SpecifiedNameQuery.new(request, MockCommandFinder.new).command
101
-
102
- expected_test_case_args = [
103
- file: "matched_file.rb",
104
- example: "example_name",
105
- request: request
106
- ]
107
-
108
- assert_includes request.recall(:test_case), expected_test_case_args
109
- end
110
- end
111
- end
112
- end