Class: Autotest::RailsRspec2
- Inherits:
-
Rspec2
- Object
- Rspec2
- Autotest::RailsRspec2
- Defined in:
- lib/autotest/rails_rspec2.rb
Instance Method Summary (collapse)
-
- (RailsRspec2) initialize
constructor
A new instance of RailsRspec2.
- - (Object) setup_rails_rspec2_mappings
Constructor Details
- (RailsRspec2) initialize
Returns a new instance of RailsRspec2
31 32 33 34 |
# File 'lib/autotest/rails_rspec2.rb', line 31 def initialize super setup_rails_rspec2_mappings end |
Instance Method Details
- (Object) setup_rails_rspec2_mappings
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/autotest/rails_rspec2.rb', line 36 def setup_rails_rspec2_mappings %w{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/.*_spec\.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|support/.*)|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 |