lib/testrbl.rb in testrbl-0.3.1 vs lib/testrbl.rb in testrbl-0.3.2

- old
+ new

@@ -10,10 +10,11 @@ OPTION_WITH_ARGUMENT = ["-I", "-r", "-n", "-e"] INTERPOLATION = /\\\#\\\{.*?\\\}/ def self.run_from_cli(argv) files, options = partition_argv(argv) + files.concat(changed_files) if options.delete("--changed") files = files.map { |f| localize(f) } load_options, options = partition_options(options) if files.size == 1 and files.first =~ /^(\S+):(\d+)$/ file = $1 @@ -92,9 +93,15 @@ else true end end end + end + + def self.changed_files + changed_files = `git status -s`.split("\n").map { |l| l.strip.split(/\s+/, 2)[1] } + raise "Failed: #{changed_files}" unless $?.success? + changed_files.select { |f| f =~ /_(test|spec)\.rb$/ && File.exist?(f) } end def self.ruby if File.file?("Gemfile") ["ruby", "-rbundler/setup"] # faster then bundle exec ruby