class Dispatch
Constants
- SPEC_FILE
Attributes
list[RW]
Public Class Methods
new(file, path)
click to toggle source
# File lib/test_officer/dispatch.rb, line 7 def initialize(file, path) @file = file.to_s @path = path.to_s end
Public Instance Methods
alternative_file(file)
click to toggle source
# File lib/test_officer/dispatch.rb, line 30 def alternative_file file file = file.split("/").last.split(".")[0] file = "#{file}_spec.rb" found = false @list.each{|f| found = f if f.include? file} found end
run_test()
click to toggle source
# File lib/test_officer/dispatch.rb, line 12 def run_test begin found = false @list = Dir.glob("**/*").each{|f| found = true if f.to_s == @file and @file =~ SPEC_FILE} if found run @file, "running #{@file}" else if found = alternative_file(@file) run found, "alternative find, running" else run 'spec', 'could not find file, running full suite ... ' end end rescue => e run 'spec', "could not find file due to errors, running full suite ... ERROR: #{e}" end end
Private Instance Methods
run(file, message)
click to toggle source
# File lib/test_officer/dispatch.rb, line 40 def run file, message puts "#{message} #{file} ... ".yellow print `rspec #{file}` end