class Autotest::RailsRspec2
def initialize
def initialize super setup_rails_rspec2_mappings end
def setup_rails_rspec2_mappings
def setup_rails_rspec2_mappings %w{config/ coverage/ db/ doc/ log/ public/ script/ tmp/ vendor/rails vendor/plugins vendor/gems}.each do |exception| add_exception(/^([\.\/]*)?#{exception}/) end clear_mappings add_mapping(%r%^(test|spec)/fixtures/(.*).yml$%) { |_, m| ["spec/models/#{m[2].singularize}_spec.rb"] + files_matching(%r%^spec\/views\/#{m[2]}/.*_spec\.rb$%) } add_mapping(%r%^spec/(models|controllers|routing|views|helpers|mailers|requests|lib)/.*rb$%) { |filename, _| filename } add_mapping(%r%^app/models/(.*)\.rb$%) { |_, m| ["spec/models/#{m[1]}_spec.rb"] } add_mapping(%r%^app/views/(.*)$%) { |_, m| files_matching %r%^spec/views/#{m[1]}_spec.rb$% } add_mapping(%r%^app/controllers/(.*)\.rb$%) { |_, m| if m[1] == "application" files_matching %r%^spec/controllers/.*_spec\.rb$% else ["spec/controllers/#{m[1]}_spec.rb"] end } add_mapping(%r%^app/helpers/(.*)_helper\.rb$%) { |_, m| if m[1] == "application" then files_matching(%r%^spec/(views|helpers)/.*_spec\.rb$%) else ["spec/helpers/#{m[1]}_helper_spec.rb"] + files_matching(%r%^spec\/views\/#{m[1]}/.*_spec\.rb$%) end } add_mapping(%r%^config/routes\.rb$%) { files_matching %r%^spec/(controllers|routing|views|helpers)/.*_spec\.rb$% } add_mapping(%r%^config/database\.yml$%) { |_, m| files_matching %r%^spec/models/.*_spec\.rb$% } add_mapping(%r%^(spec/(spec_helper|shared/.*)|config/(boot|environment(s/test)?))\.rb$%) { files_matching %r%^spec/(models|controllers|routing|views|helpers)/.*_spec\.rb$% } add_mapping(%r%^lib/(.*)\.rb$%) { |_, m| ["spec/lib/#{m[1]}_spec.rb"] } add_mapping(%r%^app/mailers/(.*)\.rb$%) { |_, m| ["spec/mailers/#{m[1]}_spec.rb"] } end