/
execute_specs.rb
52 lines (36 loc) · 1.21 KB
/
execute_specs.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
class JasmineDev < Thor
desc "execute_specs_in_node", "Run all relevant specs in Node.js"
def execute_specs_in_node
return unless node_installed?
invoke :build_distribution
invoke :count_specs
say JasmineDev.spacer
say "Running all appropriate specs via Node.js...", :cyan
with_color_option = Term::ANSIColor.coloring? ? "--color" : "--noColor"
run_with_output "node spec/node_suite.js #{with_color_option}", :capture => true
end
desc "execute_specs_in_browser", "Run all relevent specs in your default browser"
def execute_specs_in_browser
invoke :build_distribution
invoke :count_specs
say JasmineDev.spacer
say "Running all appropriate specs via the default web browser...", :cyan
open_specs_in_browser
end
desc "execute_specs", "Run all of Jasmine's specs"
def execute_specs
invoke :execute_specs_in_node
invoke :execute_specs_in_browser
end
no_tasks do
def open_specs_in_browser
require 'rbconfig'
case Object.const_get(defined?(RbConfig) ? :RbConfig : :Config)::CONFIG['host_os']
when /linux/
run "xdg-open spec/runner.html"
else
run "open spec/runner.html"
end
end
end
end