rdm 0.4.3 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/example/application/web/Package.rb +4 -0
- data/example/domain/core/spec/core/one_more_spec.rb +0 -0
- data/example/domain/core/spec/core/sample_service_spec.rb +0 -0
- data/example/tests/run +3 -4
- data/lib/rdm.rb +1 -0
- data/lib/rdm/cli/init.rb +2 -1
- data/lib/rdm/errors.rb +6 -0
- data/lib/rdm/gen/init.rb +6 -4
- data/lib/rdm/git/diff_command.rb +33 -0
- data/lib/rdm/git/diff_manager.rb +2 -1
- data/lib/rdm/handlers/dependencies_handler.rb +33 -23
- data/lib/rdm/package.rb +9 -0
- data/lib/rdm/spec_runner.rb +32 -1
- data/lib/rdm/spec_runner/runner.rb +17 -4
- data/lib/rdm/spec_runner/spec_filename_matcher.rb +26 -0
- data/lib/rdm/templates/init/tests/diff_run +2 -0
- data/lib/rdm/templates/init/tests/run +1 -1
- data/lib/rdm/utils/file_utils.rb +4 -0
- data/lib/rdm/version.rb +1 -1
- data/spec/rdm/cli/dependencies_controller_spec.rb +4 -3
- data/spec/rdm/gen/init_spec.rb +6 -5
- data/spec/rdm/handlers/dependencies_handler_spec.rb +7 -5
- data/spec/rdm/spec_runner/spec_filename_matcher_spec.rb +29 -0
- data/spec/rdm/spec_runner_spec.rb +40 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0109c0981419bf5541e8a6f8468f5d8c2985277
|
4
|
+
data.tar.gz: 92f5f415961848c52167d5320b8b0841ce9c5dac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb326efb447f26b50ffceaaf272e177849962d7199edaa96f3e9ba0c041623e64379c437420dba0a9c4cea6427c741afbb00801de49386e4b1679f2782be3ed5
|
7
|
+
data.tar.gz: afca747cd4fe39e13f2a1b60028631479dc81302aa49254db9da00a07c4a163adca4511add7f1440859723c992d0e83a3f3b0c56eca9726bf194867e69a58269
|
data/Gemfile.lock
CHANGED
File without changes
|
File without changes
|
data/example/tests/run
CHANGED
@@ -15,8 +15,7 @@
|
|
15
15
|
ENV['RUBY_ENV'] = 'test'
|
16
16
|
require 'rdm'
|
17
17
|
|
18
|
-
|
19
|
-
skipped_packages = File.open(runignore_path).each_line.inject([]) { |all, line| all.push(line.chomp!) }
|
18
|
+
Rdm.root(__FILE__)
|
20
19
|
|
21
20
|
if ENV['TEST_RUN']
|
22
21
|
require 'minitest/autorun'
|
@@ -34,9 +33,9 @@ if ENV['TEST_RUN']
|
|
34
33
|
else
|
35
34
|
Rdm::SpecRunner.run(
|
36
35
|
package: ARGV.clone.first,
|
37
|
-
spec_matcher: ARGV.clone
|
36
|
+
spec_matcher: ARGV.clone[1],
|
38
37
|
path: File.expand_path(__FILE__),
|
39
|
-
|
38
|
+
skip_ignored_packages: true,
|
40
39
|
show_missing_packages: true
|
41
40
|
)
|
42
41
|
end
|
data/lib/rdm.rb
CHANGED
data/lib/rdm/cli/init.rb
CHANGED
@@ -18,7 +18,8 @@ module Rdm
|
|
18
18
|
generated_files_list = Rdm::Gen::Init.generate(
|
19
19
|
current_path: @current_path,
|
20
20
|
test: @test,
|
21
|
-
console: @console
|
21
|
+
console: @console,
|
22
|
+
stdout: @stdout
|
22
23
|
)
|
23
24
|
|
24
25
|
generated_files_list.compact.each { |file| @stdout.puts "Generated: #{file}" }
|
data/lib/rdm/errors.rb
CHANGED
data/lib/rdm/gen/init.rb
CHANGED
@@ -9,16 +9,17 @@ module Rdm
|
|
9
9
|
LOCAL_TEMPLATES_PATH = '.rdm/templates'
|
10
10
|
|
11
11
|
class << self
|
12
|
-
def generate(current_path:, test: 'rspec', console: 'irb')
|
13
|
-
Rdm::Gen::Init.new(current_path, test, console).generate
|
12
|
+
def generate(current_path:, test: 'rspec', console: 'irb', stdout: STDOUT)
|
13
|
+
Rdm::Gen::Init.new(current_path, test, console, stdout).generate
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def initialize(current_path, test, console)
|
17
|
+
def initialize(current_path, test, console, stdout)
|
18
18
|
@current_path = current_path
|
19
19
|
@test = test
|
20
20
|
@console = console
|
21
21
|
@template_detector = Rdm::Templates::TemplateDetector.new(current_path)
|
22
|
+
@stdout = stdout
|
22
23
|
end
|
23
24
|
|
24
25
|
def generate
|
@@ -41,7 +42,8 @@ module Rdm
|
|
41
42
|
template_name: TEMPLATE_NAME,
|
42
43
|
current_path: @current_path,
|
43
44
|
local_path: INIT_PATH,
|
44
|
-
ignore_source_file: true
|
45
|
+
ignore_source_file: true,
|
46
|
+
stdout: @stdout
|
45
47
|
)
|
46
48
|
end
|
47
49
|
|
data/lib/rdm/git/diff_command.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class Rdm::Git::DiffCommand
|
2
|
+
GIT_FILE_REPLACE_REGEX = /{(?<old>[\w_\d\.]+)\s*=>\s*(?<new>[\w_\d\.]+)}/
|
3
|
+
|
2
4
|
class << self
|
3
5
|
def get_only_diff_filenames(revision:, path:)
|
4
6
|
command = `cd #{path} && git diff --name-only #{revision}`
|
@@ -7,5 +9,36 @@ class Rdm::Git::DiffCommand
|
|
7
9
|
|
8
10
|
command.split("\n")
|
9
11
|
end
|
12
|
+
|
13
|
+
def get_diff_stat(revision:, path:)
|
14
|
+
command = `cd #{path} && git diff --stat #{revision}`
|
15
|
+
|
16
|
+
raise Rdm::Errors::GitCommandError, command unless $?.success?
|
17
|
+
|
18
|
+
format_diff_stat_command(command)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def format_diff_stat_command(command)
|
24
|
+
files_list = command
|
25
|
+
.split("\n")[0..-2] # remove last string with statistics
|
26
|
+
.map do |stat_string|
|
27
|
+
file_name = stat_string.split('|').first.strip
|
28
|
+
|
29
|
+
match_data = GIT_FILE_REPLACE_REGEX.match(file_name)
|
30
|
+
|
31
|
+
if match_data
|
32
|
+
file_name = [
|
33
|
+
file_name.gsub(GIT_FILE_REPLACE_REGEX, match_data[:old]),
|
34
|
+
file_name.gsub(GIT_FILE_REPLACE_REGEX, match_data[:new])
|
35
|
+
]
|
36
|
+
end
|
37
|
+
|
38
|
+
file_name
|
39
|
+
end
|
40
|
+
|
41
|
+
files_list.flatten
|
42
|
+
end
|
10
43
|
end
|
11
44
|
end
|
data/lib/rdm/git/diff_manager.rb
CHANGED
@@ -13,7 +13,8 @@ module Rdm
|
|
13
13
|
check_repository_initialized!(abs_path)
|
14
14
|
|
15
15
|
return Rdm::Git::DiffCommand
|
16
|
-
.
|
16
|
+
.get_diff_stat(revision: revision, path: abs_path)
|
17
|
+
.reject(&:empty?)
|
17
18
|
.map { |filename| File.expand_path(File.join(abs_path, filename)) }
|
18
19
|
end
|
19
20
|
|
@@ -13,6 +13,10 @@ module Rdm
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def draw(package_name:, project_path:)
|
16
|
+
if package_name.to_s.empty?
|
17
|
+
raise Rdm::Errors::InvalidParams, "Type package name, ex: rdm gen.deps repository"
|
18
|
+
end
|
19
|
+
|
16
20
|
new(package_name, project_path).draw
|
17
21
|
end
|
18
22
|
end
|
@@ -42,34 +46,43 @@ module Rdm
|
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
45
|
-
def draw(
|
46
|
-
|
49
|
+
def draw(package_data = nil, uniq_packages = [], self_predicate = '', child_predicate = '')
|
50
|
+
package_data ||= {
|
51
|
+
name: @package_name,
|
52
|
+
groups: [Rdm::Package::DEFAULT_GROUP]
|
53
|
+
}
|
54
|
+
|
47
55
|
raise Rdm::Errors::PackageHasNoDependencies, @package_name if source.packages[@package_name].local_dependencies.empty?
|
48
56
|
|
49
|
-
node = [
|
57
|
+
node = [format_package_name(package_data[:name], package_data[:groups], self_predicate)]
|
50
58
|
|
51
|
-
return node if
|
59
|
+
return node if package_data[:name] == ALREADY_MENTIONED_DEPS
|
52
60
|
|
53
|
-
local_dependencies = source.packages[
|
61
|
+
local_dependencies = source.packages[package_data[:name]].local_dependencies_with_groups
|
54
62
|
|
55
|
-
if uniq_packages.include?(
|
56
|
-
local_dependencies = local_dependencies.count == 0 ?
|
63
|
+
if uniq_packages.include?(package_data[:name])
|
64
|
+
local_dependencies = local_dependencies.keys.count == 0 ? {} : {ALREADY_MENTIONED_DEPS => [Rdm::Package::DEFAULT_GROUP]}
|
57
65
|
else
|
58
|
-
uniq_packages.push(
|
66
|
+
uniq_packages.push(package_data[:name])
|
59
67
|
end
|
60
68
|
|
61
|
-
local_dependencies.
|
62
|
-
|
69
|
+
local_dependencies.each do |k, v|
|
70
|
+
local_dependencies.delete(k)
|
63
71
|
|
64
72
|
if local_dependencies.empty?
|
65
|
-
tmp_self_predicate = child_predicate
|
66
|
-
tmp_child_predicate = child_predicate + '
|
73
|
+
tmp_self_predicate = child_predicate + '└── '
|
74
|
+
tmp_child_predicate = child_predicate + ' '
|
67
75
|
else
|
68
|
-
tmp_self_predicate = child_predicate
|
69
|
-
tmp_child_predicate = child_predicate + '
|
76
|
+
tmp_self_predicate = child_predicate + '├── '
|
77
|
+
tmp_child_predicate = child_predicate + '| '
|
70
78
|
end
|
71
|
-
|
72
|
-
|
79
|
+
|
80
|
+
next_package_group = {
|
81
|
+
name: k,
|
82
|
+
groups: v
|
83
|
+
}
|
84
|
+
|
85
|
+
node.push(*draw(next_package_group, uniq_packages, tmp_self_predicate, tmp_child_predicate))
|
73
86
|
end
|
74
87
|
|
75
88
|
node
|
@@ -81,13 +94,10 @@ module Rdm
|
|
81
94
|
@source ||= Rdm::SourceParser.read_and_init_source(Rdm::SourceLocator.locate(@project_path))
|
82
95
|
end
|
83
96
|
|
84
|
-
def
|
85
|
-
|
86
|
-
|
87
|
-
.
|
88
|
-
.gsub(/1/, '├── ')
|
89
|
-
.gsub(/2/, '└── ')
|
90
|
-
.gsub(/3/, '| ')
|
97
|
+
def format_package_name(package_name, package_groups, predicate)
|
98
|
+
package_groups.include?(Rdm::Package::DEFAULT_GROUP) ?
|
99
|
+
"#{predicate}#{package_name}" :
|
100
|
+
"#{predicate}#{package_name} (#{package_groups.join(', ')})"
|
91
101
|
end
|
92
102
|
|
93
103
|
def recursive_find_dependencies(package_names)
|
data/lib/rdm/package.rb
CHANGED
@@ -19,6 +19,15 @@ class Rdm::Package
|
|
19
19
|
fetch_dependencies(@config_dependencies || {}, group)
|
20
20
|
end
|
21
21
|
|
22
|
+
def local_dependencies_with_groups
|
23
|
+
return {} if @local_dependencies.nil?
|
24
|
+
@local_dependencies.each_with_object(
|
25
|
+
Hash.new { |h,k| h[k]=[] }
|
26
|
+
) do|(k,v), h|
|
27
|
+
v.map { |t| h[t] << k }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
22
31
|
# Import local dependency, e.g another package
|
23
32
|
def import(dependency)
|
24
33
|
@local_dependencies ||= {}
|
data/lib/rdm/spec_runner.rb
CHANGED
@@ -4,7 +4,9 @@ module Rdm::SpecRunner
|
|
4
4
|
package: nil,
|
5
5
|
spec_matcher: nil,
|
6
6
|
show_missing_packages: true,
|
7
|
-
skip_ignored_packages: false
|
7
|
+
skip_ignored_packages: false,
|
8
|
+
stdout: STDOUT,
|
9
|
+
stdin: STDIN
|
8
10
|
)
|
9
11
|
Rdm::SpecRunner::Runner.new(
|
10
12
|
path: path,
|
@@ -13,5 +15,34 @@ module Rdm::SpecRunner
|
|
13
15
|
show_missing_packages: show_missing_packages,
|
14
16
|
skip_ignored_packages: skip_ignored_packages
|
15
17
|
).run
|
18
|
+
|
19
|
+
rescue Rdm::Errors::SpecMatcherNoFiles => e
|
20
|
+
stdout.puts e.message
|
21
|
+
rescue Rdm::Errors::SpecMatcherMultipleFiles => e
|
22
|
+
spec_files = e.message.split("\n")
|
23
|
+
format_spec_files = spec_files.map.with_index {|file, idx| "#{idx+1}. #{file}"}.join("\n")
|
24
|
+
|
25
|
+
stdout.puts "Following specs match your input:"
|
26
|
+
stdout.puts format_spec_files
|
27
|
+
stdout.print "Enter space-separated file numbers, ex: '1 2': "
|
28
|
+
selected_files_numbers = stdin.gets.chomp
|
29
|
+
.split(' ')
|
30
|
+
.map {|x| Integer(x) rescue nil }
|
31
|
+
.compact
|
32
|
+
.map {|n| n - 1}
|
33
|
+
.reject {|n| n >= spec_files.size}
|
34
|
+
|
35
|
+
spec_files
|
36
|
+
.select
|
37
|
+
.with_index {|_file, idx| selected_files_numbers.include?(idx)}
|
38
|
+
.each do |file|
|
39
|
+
Rdm::SpecRunner::Runner.new(
|
40
|
+
path: path,
|
41
|
+
package: package,
|
42
|
+
spec_matcher: file,
|
43
|
+
show_missing_packages: show_missing_packages,
|
44
|
+
skip_ignored_packages: skip_ignored_packages
|
45
|
+
).run
|
46
|
+
end
|
16
47
|
end
|
17
48
|
end
|
@@ -12,9 +12,9 @@ class Rdm::SpecRunner::Runner
|
|
12
12
|
show_missing_packages: true,
|
13
13
|
skip_ignored_packages: false
|
14
14
|
)
|
15
|
-
@
|
16
|
-
@spec_matcher = spec_matcher.to_s
|
15
|
+
@package_name = package
|
17
16
|
@no_specs_packages = []
|
17
|
+
@spec_matcher = spec_matcher.to_s
|
18
18
|
@path = path
|
19
19
|
@run_all = @package.nil?
|
20
20
|
@show_missing_packages = show_missing_packages
|
@@ -23,6 +23,19 @@ class Rdm::SpecRunner::Runner
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def run
|
26
|
+
if !@spec_matcher.empty?
|
27
|
+
@spec_file_matches = Rdm::SpecRunner::SpecFilenameMatcher.find_matches(package_path: packages[@package_name].path, spec_matcher: @spec_matcher)
|
28
|
+
case @spec_file_matches.size
|
29
|
+
when 0
|
30
|
+
raise Rdm::Errors::SpecMatcherNoFiles, "No specs were found for '#{@spec_matcher}'"
|
31
|
+
when 1
|
32
|
+
@spec_matcher = @spec_file_matches.first
|
33
|
+
puts "Following spec matches your input: #{@spec_matcher}"
|
34
|
+
else
|
35
|
+
raise Rdm::Errors::SpecMatcherMultipleFiles, @spec_file_matches.join("\n")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
26
39
|
prepare!
|
27
40
|
check_input_params!
|
28
41
|
display_missing_specs if @show_missing_packages
|
@@ -115,14 +128,14 @@ class Rdm::SpecRunner::Runner
|
|
115
128
|
end
|
116
129
|
|
117
130
|
def prepare_command_for_packages(packages_command_params)
|
118
|
-
if @skip_ignored_packages
|
131
|
+
if @skip_ignored_packages && !@package
|
119
132
|
runignore_path = File.expand_path(File.join(Rdm.root_dir, RUNIGNORE_PATH))
|
120
133
|
package_list = Rdm::SourceParser.read_and_init_source(Rdm.root).packages.keys
|
121
134
|
|
122
135
|
skipped_package_list = File.read(runignore_path)
|
123
136
|
.lines
|
124
137
|
.map(&:strip)
|
125
|
-
.reject(&:empty?) rescue
|
138
|
+
.reject(&:empty?) rescue []
|
126
139
|
|
127
140
|
@skipped_packages = skipped_package_list.reject {|line| !package_list.include?(line)}
|
128
141
|
invalid_ignore_packages = skipped_package_list - @skipped_packages
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Rdm::SpecRunner::SpecFilenameMatcher
|
2
|
+
class << self
|
3
|
+
def find_matches(package_path:, spec_matcher:)
|
4
|
+
Rdm::SpecRunner::SpecFilenameMatcher.new(package_path, spec_matcher).find_matches
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(package_path, spec_matcher)
|
9
|
+
@package_path = package_path
|
10
|
+
@spec_matcher = spec_matcher
|
11
|
+
end
|
12
|
+
|
13
|
+
def find_matches
|
14
|
+
expected_filename = File.join(@package_path, @spec_matcher)
|
15
|
+
|
16
|
+
if File.exists?(expected_filename)
|
17
|
+
return Rdm::Utils::FileUtils.relative_path(path: expected_filename, from: @package_path).split
|
18
|
+
end
|
19
|
+
|
20
|
+
Dir.glob(File.join(@package_path, '**/*_spec.rb'))
|
21
|
+
.select { |fn| File.file?(fn) }
|
22
|
+
.map {|file| Rdm::Utils::FileUtils.relative_path(path: file, from: @package_path) }
|
23
|
+
.grep(/#{@spec_matcher.split('').join('.*')}/)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/lib/rdm/utils/file_utils.rb
CHANGED
data/lib/rdm/version.rb
CHANGED
@@ -18,11 +18,12 @@ describe Rdm::CLI::DependenciesController do
|
|
18
18
|
stdout: stdout
|
19
19
|
)
|
20
20
|
|
21
|
-
expect(stdout.output).to
|
21
|
+
expect(stdout.output.last).to match(
|
22
22
|
[
|
23
23
|
"web",
|
24
|
-
"
|
25
|
-
"
|
24
|
+
"├── core",
|
25
|
+
"| └── repository",
|
26
|
+
"└── repository (test)"
|
26
27
|
]
|
27
28
|
)
|
28
29
|
end
|
data/spec/rdm/gen/init_spec.rb
CHANGED
@@ -3,14 +3,15 @@ require "spec_helper"
|
|
3
3
|
describe Rdm::Gen::Init do
|
4
4
|
include ExampleProjectHelper
|
5
5
|
|
6
|
-
subject
|
6
|
+
subject { described_class }
|
7
|
+
let(:stdout) { SpecLogger.new }
|
7
8
|
|
8
9
|
before { initialize_example_project(skip_rdm_init: true) }
|
9
10
|
after { reset_example_project }
|
10
11
|
|
11
12
|
context "sample project" do
|
12
13
|
it "has generated correct files" do
|
13
|
-
subject.generate(current_path: example_project_path)
|
14
|
+
subject.generate(current_path: example_project_path, stdout: stdout)
|
14
15
|
|
15
16
|
FileUtils.cd(example_project_path) do
|
16
17
|
ensure_exists("Rdm.packages")
|
@@ -25,7 +26,7 @@ describe Rdm::Gen::Init do
|
|
25
26
|
end
|
26
27
|
|
27
28
|
it "has generated package templates" do
|
28
|
-
subject.generate(current_path: example_project_path)
|
29
|
+
subject.generate(current_path: example_project_path, stdout: stdout)
|
29
30
|
|
30
31
|
FileUtils.cd(example_project_path) do
|
31
32
|
ensure_exists(".rdm/templates/package/Package.rb")
|
@@ -40,10 +41,10 @@ describe Rdm::Gen::Init do
|
|
40
41
|
|
41
42
|
context "prevents double execution" do
|
42
43
|
it "raises on second project generation" do
|
43
|
-
subject.generate(current_path: example_project_path)
|
44
|
+
subject.generate(current_path: example_project_path, stdout: stdout)
|
44
45
|
|
45
46
|
expect {
|
46
|
-
subject.generate(current_path: example_project_path)
|
47
|
+
subject.generate(current_path: example_project_path, stdout: stdout)
|
47
48
|
}.to raise_error(Rdm::Errors::ProjectAlreadyInitialized)
|
48
49
|
end
|
49
50
|
end
|
@@ -47,8 +47,9 @@ describe Rdm::Handlers::DependenciesHandler do
|
|
47
47
|
expect(result).to match(
|
48
48
|
[
|
49
49
|
"web",
|
50
|
-
"
|
51
|
-
"
|
50
|
+
"├── core",
|
51
|
+
"| └── repository",
|
52
|
+
"└── repository (test)"
|
52
53
|
]
|
53
54
|
)
|
54
55
|
end
|
@@ -73,9 +74,10 @@ describe Rdm::Handlers::DependenciesHandler do
|
|
73
74
|
expect(result).to match(
|
74
75
|
[
|
75
76
|
"web",
|
76
|
-
"
|
77
|
-
"
|
78
|
-
"
|
77
|
+
"├── core",
|
78
|
+
"| └── web",
|
79
|
+
"| └── ...",
|
80
|
+
"└── repository (test)"
|
79
81
|
]
|
80
82
|
)
|
81
83
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rdm::SpecRunner::SpecFilenameMatcher do
|
4
|
+
include ExampleProjectHelper
|
5
|
+
|
6
|
+
before { initialize_example_project }
|
7
|
+
after { reset_example_project }
|
8
|
+
|
9
|
+
subject { described_class }
|
10
|
+
let(:existing_file) { 'spec/core/one_more_spec.rb' }
|
11
|
+
let(:short_filename) { 'sc.rb' }
|
12
|
+
let(:package_path) { File.join(example_project_path, 'domain/core') }
|
13
|
+
|
14
|
+
context 'file_path exists' do
|
15
|
+
it 'returns array with file_path matches' do
|
16
|
+
expect(
|
17
|
+
subject.find_matches(package_path: package_path, spec_matcher: existing_file)
|
18
|
+
).to eq([existing_file])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'file_path does not exist' do
|
23
|
+
it 'returns array of relative to package matches' do
|
24
|
+
expect(
|
25
|
+
subject.find_matches(package_path: package_path, spec_matcher: short_filename)
|
26
|
+
).to match(["spec/core/one_more_spec.rb", "spec/core/sample_service_spec.rb"])
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rdm::SpecRunner do
|
4
|
+
include ExampleProjectHelper
|
5
|
+
|
6
|
+
before { initialize_example_project }
|
7
|
+
after { reset_example_project }
|
8
|
+
|
9
|
+
subject { described_class }
|
10
|
+
let(:stdout) { SpecLogger.new }
|
11
|
+
|
12
|
+
context "for specified spec_matcher" do
|
13
|
+
context "if no files match spec_matcher" do
|
14
|
+
it 'output warning message' do
|
15
|
+
subject.run(
|
16
|
+
path: example_project_path,
|
17
|
+
package: 'core',
|
18
|
+
spec_matcher: 'not_existing_file.rb',
|
19
|
+
stdout: stdout
|
20
|
+
)
|
21
|
+
|
22
|
+
expect(stdout.output).to include("No specs were found for 'not_existing_file.rb'")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "if multiple files match spec_matcher" do
|
27
|
+
it 'output list of matches' do
|
28
|
+
subject.run(
|
29
|
+
path: example_project_path,
|
30
|
+
package: 'core',
|
31
|
+
spec_matcher: 'spec.rb',
|
32
|
+
stdout: stdout,
|
33
|
+
stdin: SpecLogger.new(stdin: "exit\n")
|
34
|
+
)
|
35
|
+
|
36
|
+
expect(stdout.output).to match(["Following specs match your input:", "1. spec/core/one_more_spec.rb\n2. spec/core/sample_service_spec.rb", "Enter space-separated file numbers, ex: '1 2': "])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Droid Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -157,6 +157,8 @@ files:
|
|
157
157
|
- example/domain/core/Package.rb
|
158
158
|
- example/domain/core/package/core.rb
|
159
159
|
- example/domain/core/package/core/sample_service.rb
|
160
|
+
- example/domain/core/spec/core/one_more_spec.rb
|
161
|
+
- example/domain/core/spec/core/sample_service_spec.rb
|
160
162
|
- example/env_files/development.env
|
161
163
|
- example/env_files/production.env
|
162
164
|
- example/env_files/test.env
|
@@ -207,6 +209,7 @@ files:
|
|
207
209
|
- lib/rdm/spec_runner/command_params.rb
|
208
210
|
- lib/rdm/spec_runner/package_fetcher.rb
|
209
211
|
- lib/rdm/spec_runner/runner.rb
|
212
|
+
- lib/rdm/spec_runner/spec_filename_matcher.rb
|
210
213
|
- lib/rdm/spec_runner/view.rb
|
211
214
|
- lib/rdm/templates/configs/<%=config_path%>
|
212
215
|
- lib/rdm/templates/configs/<%=role_config_path%>
|
@@ -266,6 +269,8 @@ files:
|
|
266
269
|
- spec/rdm/source_locator_spec.rb
|
267
270
|
- spec/rdm/source_parser_spec.rb
|
268
271
|
- spec/rdm/spec_runner/runner_spec.rb
|
272
|
+
- spec/rdm/spec_runner/spec_filename_matcher_spec.rb
|
273
|
+
- spec/rdm/spec_runner_spec.rb
|
269
274
|
- spec/rdm/templates/template_detector_spec.rb
|
270
275
|
- spec/rdm/templates/template_renderer_spec.rb
|
271
276
|
- spec/spec_helper.rb
|
@@ -324,6 +329,8 @@ test_files:
|
|
324
329
|
- spec/rdm/source_locator_spec.rb
|
325
330
|
- spec/rdm/source_parser_spec.rb
|
326
331
|
- spec/rdm/spec_runner/runner_spec.rb
|
332
|
+
- spec/rdm/spec_runner/spec_filename_matcher_spec.rb
|
333
|
+
- spec/rdm/spec_runner_spec.rb
|
327
334
|
- spec/rdm/templates/template_detector_spec.rb
|
328
335
|
- spec/rdm/templates/template_renderer_spec.rb
|
329
336
|
- spec/spec_helper.rb
|