17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/discourse_theme/cli_commands/rspec.rb', line 17
def run(settings:, dir:, args:, reset: false)
settings.local_discourse_directory = nil if reset
spec_path = "/spec"
index = dir.index(spec_path)
if index
spec_path = dir[index..-1]
dir = dir[0..index - 1]
end
spec_directory = File.join(dir, "/spec")
unless Dir.exist?(spec_directory)
raise DiscourseTheme::ThemeError.new "'#{spec_directory} does not exist"
end
configure_local_directory(settings)
headless = !args.delete("--headful")
if settings.local_discourse_directory.empty?
run_tests_with_docker(
dir,
spec_directory,
spec_path,
headless: headless,
verbose: !!args.delete("--verbose"),
rebuild: !!args.delete("--rebuild"),
)
else
run_tests_locally(
settings.local_discourse_directory,
File.join(dir, spec_path),
headless: headless,
)
end
end
|