diff options
author | Ian Taylor <ian@lorf.org> | 2009-06-05 12:38:52 -0400 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-06-06 09:11:46 +1000 |
commit | 97e6975d69f239e24993315a25a3117b1daa48c3 (patch) | |
tree | 2ef7040415ed14ac77378bacc531161e488937ee /autotest | |
parent | 41ce18cc8ea239d1633fc6cd9e9f599957a82e74 (diff) | |
download | puppet-97e6975d69f239e24993315a25a3117b1daa48c3.tar.gz puppet-97e6975d69f239e24993315a25a3117b1daa48c3.tar.xz puppet-97e6975d69f239e24993315a25a3117b1daa48c3.zip |
Changed indentation to be more consistent with style guide (4 spaces per level)
Diffstat (limited to 'autotest')
-rw-r--r-- | autotest/discover.rb | 4 | ||||
-rw-r--r-- | autotest/rspec.rb | 110 |
2 files changed, 57 insertions, 57 deletions
diff --git a/autotest/discover.rb b/autotest/discover.rb index 0ac563724..528f6cc10 100644 --- a/autotest/discover.rb +++ b/autotest/discover.rb @@ -1,9 +1,9 @@ require 'autotest' Autotest.add_discovery do - "rspec" + "rspec" end Autotest.add_discovery do - "puppet" + "puppet" end diff --git a/autotest/rspec.rb b/autotest/rspec.rb index ebafbfe91..707429d2e 100644 --- a/autotest/rspec.rb +++ b/autotest/rspec.rb @@ -1,74 +1,74 @@ require 'autotest' Autotest.add_hook :initialize do |at| - at.clear_mappings - # watch out: Ruby bug (1.8.6): - # %r(/) != /\// - at.add_mapping(%r%^spec/.*\.rb$%) { |filename, _| - filename - } - at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m| - ["spec/#{m[1]}_spec.rb"] - } - at.add_mapping(%r%^spec/(spec_helper|shared/.*)\.rb$%) { - at.files_matching %r{^spec/.*_spec\.rb$} - } + at.clear_mappings + # watch out: Ruby bug (1.8.6): + # %r(/) != /\// + at.add_mapping(%r%^spec/.*\.rb$%) { |filename, _| + filename + } + at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m| + ["spec/#{m[1]}_spec.rb"] + } + at.add_mapping(%r%^spec/(spec_helper|shared/.*)\.rb$%) { + at.files_matching %r{^spec/.*_spec\.rb$} + } end class RspecCommandError < StandardError; end class Autotest::Rspec < Autotest - def initialize - super + def initialize + super - self.failed_results_re = /^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m - self.completed_re = /\Z/ # FIX: some sort of summary line at the end? - end + self.failed_results_re = /^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m + self.completed_re = /\Z/ # FIX: some sort of summary line at the end? + end - def consolidate_failures(failed) - filters = Hash.new { |h,k| h[k] = [] } - failed.each do |spec, failed_trace| - if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } then - filters[f] << spec - break - end + def consolidate_failures(failed) + filters = Hash.new { |h,k| h[k] = [] } + failed.each do |spec, failed_trace| + if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } then + filters[f] << spec + break + end + end + return filters end - return filters - end - def make_test_cmd(files_to_test) - return "#{ruby} -S #{spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}" - end - - def add_options_if_present - File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : "" - end + def make_test_cmd(files_to_test) + return "#{ruby} -S #{spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}" + end - # Finds the proper spec command to use. Precendence is set in the - # lazily-evaluated method spec_commands. Alias + Override that in - # ~/.autotest to provide a different spec command then the default - # paths provided. - def spec_command(separator=File::ALT_SEPARATOR) - unless defined? @spec_command then - @spec_command = spec_commands.find { |cmd| File.exists? cmd } + def add_options_if_present + File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : "" + end - raise RspecCommandError, "No spec command could be found!" unless @spec_command + # Finds the proper spec command to use. Precendence is set in the + # lazily-evaluated method spec_commands. Alias + Override that in + # ~/.autotest to provide a different spec command then the default + # paths provided. + def spec_command(separator=File::ALT_SEPARATOR) + unless defined? @spec_command then + @spec_command = spec_commands.find { |cmd| File.exists? cmd } - @spec_command.gsub! File::SEPARATOR, separator if separator + raise RspecCommandError, "No spec command could be found!" unless @spec_command + + @spec_command.gsub! File::SEPARATOR, separator if separator + end + @spec_command end - @spec_command - end - # Autotest will look for spec commands in the following - # locations, in this order: - # - # * bin/spec - # * default spec bin/loader installed in Rubygems - def spec_commands - [ - File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')), - File.join(Config::CONFIG['bindir'], 'spec') - ] - end + # Autotest will look for spec commands in the following + # locations, in this order: + # + # * bin/spec + # * default spec bin/loader installed in Rubygems + def spec_commands + [ + File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')), + File.join(Config::CONFIG['bindir'], 'spec') + ] + end end |