lib/soundcheck.rb in soundcheck-0.0.2 vs lib/soundcheck.rb in soundcheck-0.1.0

- old
+ new

@@ -1,22 +1,28 @@ class Soundcheck attr_accessor :path - def initialize(path = "spec") - @path = path || "spec" + def initialize(path = "spec", options = {}) + @options = options + + if options[:fast] + @path = `grep -r -L 'spec_helper' #{path || "spec"} | grep '_spec.rb'`.strip.gsub("\n", " ") + else + @path = path || "spec" + end end def command_to_run if has_gemfile? if requires_spec_helper? - return "rspec #{@path}" + return "rspec --drb #{@path}" else - return "bundle exec rspec #{@path}" + return "bundle exec rspec --drb #{@path}" end end # Assume rspec - "rspec #{@path}" + "rspec --drb #{@path}" end def requires_spec_helper? `grep -r 'spec_helper' #{@path}` $?.exitstatus == 1 # no match; we have a stand-alone spec