Class: Providence::RspecWatchr
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseWatchr
alert_message, fail_message, pass_message, pending_message, run, run_command
Class Method Details
.command ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/providence/rspec_watchr.rb', line 32
def command
if Gem.searcher.find('rspec').nil?
"env RSPEC_COLOR=true spec --drb --colour --format nested"
else
"rspec --tty --drb --colour --format nested"
end
end
|
.parse_test_status(status) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/providence/rspec_watchr.rb', line 12
def parse_test_status(status)
status = status.join('').gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/, '')
if status.match(/\s0\s(errors|failures)/)
status.match(/pending/) ? :pending : :pass
elsif status.match(/(error|failure)/)
:fail
else
:alert
end
end
|
28
29
30
|
# File 'lib/providence/rspec_watchr.rb', line 28
def related(path)
Dir['spec/**/*.rb'].select { |file| file =~ /#{File.basename(path).split(".").first}_spec.rb/ }
end
|
.run_all ⇒ Object
24
25
26
|
# File 'lib/providence/rspec_watchr.rb', line 24
def run_all
run 'spec'
end
|
Instance Method Details
#watch(ec) ⇒ Object
order matters here, top is last to match, bottom is first