Class: Autotest::Merb
- Inherits:
-
Autotest
- Object
- Autotest
- Autotest::Merb
- Defined in:
- lib/generators/templates/application/merb_stack/autotest/merb.rb,
lib/generators/templates/application/merb_core/autotest/merb.rb
Instance Attribute Summary collapse
-
#controller_tests_dir ⇒ Object
model_tests_dir
- the directory to find model-centric tests
controller_tests_dir
- the directory to find controller-centric tests
view_tests_dir
- the directory to find view-centric tests
fixtures_dir
-
the directory to find fixtures in.
- the directory to find view-centric tests
- the directory to find controller-centric tests
- the directory to find model-centric tests
-
#fixtures_dir ⇒ Object
model_tests_dir
- the directory to find model-centric tests
controller_tests_dir
- the directory to find controller-centric tests
view_tests_dir
- the directory to find view-centric tests
fixtures_dir
-
the directory to find fixtures in.
- the directory to find view-centric tests
- the directory to find controller-centric tests
- the directory to find model-centric tests
-
#model_tests_dir ⇒ Object
model_tests_dir
- the directory to find model-centric tests
controller_tests_dir
- the directory to find controller-centric tests
view_tests_dir
- the directory to find view-centric tests
fixtures_dir
-
the directory to find fixtures in.
- the directory to find view-centric tests
- the directory to find controller-centric tests
- the directory to find model-centric tests
-
#view_tests_dir ⇒ Object
model_tests_dir
- the directory to find model-centric tests
controller_tests_dir
- the directory to find controller-centric tests
view_tests_dir
- the directory to find view-centric tests
fixtures_dir
-
the directory to find fixtures in.
- the directory to find view-centric tests
- the directory to find controller-centric tests
- the directory to find model-centric tests
Instance Method Summary collapse
-
#initialize ⇒ Merb
constructor
A new instance of Merb.
Constructor Details
#initialize ⇒ Merb
Returns a new instance of Merb.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/generators/templates/application/merb_stack/autotest/merb.rb', line 12 def initialize super initialize_test_layout # Ignore any happenings in these directories add_exception %r%^\./(?:doc|log|public|tmp|\.git|\.hg|\.svn|framework|gems|schema|\.DS_Store|autotest|bin|.*\.sqlite3)% # Ignore SCM directories and custom Autotest mappings %w[.svn .hg .git .autotest].each { |exception| add_exception(exception) } # Ignore any mappings that Autotest may have already set up clear_mappings # Any changes to a file in the root of the 'lib' directory will run any # model test with a corresponding name. add_mapping %r%^lib\/.*\.rb% do |filename, _| files_matching Regexp.new(["^#{model_test_for(filename)}$"]) end # Any changes to a fixture will run corresponding view, controller and # model tests add_mapping %r%^#{fixtures_dir}/(.*)s.yml% do |_, m| [ model_test_for(m[1]), controller_test_for(m[1]), view_test_for(m[1]) ] end # Any change to a test will cause it to be run add_mapping %r%^test/(unit|models|integration|controllers|views|functional)/.*rb$% do |filename, _| filename end # Any change to a model will cause it's corresponding test to be run add_mapping %r%^app/models/(.*)\.rb$% do |_, m| model_test_for(m[1]) end # Any change to the global helper will result in all view and controller # tests being run add_mapping %r%^app/helpers/global_helpers.rb% do files_matching %r%^test/(views|functional|controllers)/.*_test\.rb$% end # Any change to a helper will run it's corresponding view and controller # tests, unless the helper is the global helper. Changes to the global # helper run all view and controller tests. add_mapping %r%^app/helpers/(.*)_helper(s)?.rb% do |_, m| if m[1] == "global" then files_matching %r%^test/(views|functional|controllers)/.*_test\.rb$% else [ view_test_for(m[1]), controller_test_for(m[1]) ] end end # Changes to views result in their corresponding view and controller test # being run add_mapping %r%^app/views/(.*)/% do |_, m| [ view_test_for(m[1]), controller_test_for(m[1]) ] end # Changes to a controller result in its corresponding test being run. If # the controller is the exception or application controller, all # controller tests are run. add_mapping %r%^app/controllers/(.*)\.rb$% do |_, m| if ["application", "exception"].include?(m[1]) files_matching %r%^test/(controllers|views|functional)/.*_test\.rb$% else controller_test_for(m[1]) end end # If a change is made to the router, run all controller and view tests add_mapping %r%^config/router.rb$% do # FIX files_matching %r%^test/(controllers|views|functional)/.*_test\.rb$% end # If any of the major files governing the environment are altered, run # everything add_mapping %r%^test/test_helper.rb|config/(init|rack|environments/test.rb|database.yml)% do # FIX files_matching %r%^test/(unit|models|controllers|views|functional)/.*_test\.rb$% end end |
Instance Attribute Details
#controller_tests_dir ⇒ Object
model_tests_dir
-
the directory to find model-centric tests
controller_tests_dir
-
the directory to find controller-centric tests
view_tests_dir
-
the directory to find view-centric tests
fixtures_dir
-
the directory to find fixtures in
10 11 12 |
# File 'lib/generators/templates/application/merb_stack/autotest/merb.rb', line 10 def controller_tests_dir @controller_tests_dir end |
#fixtures_dir ⇒ Object
model_tests_dir
-
the directory to find model-centric tests
controller_tests_dir
-
the directory to find controller-centric tests
view_tests_dir
-
the directory to find view-centric tests
fixtures_dir
-
the directory to find fixtures in
10 11 12 |
# File 'lib/generators/templates/application/merb_stack/autotest/merb.rb', line 10 def fixtures_dir @fixtures_dir end |
#model_tests_dir ⇒ Object
model_tests_dir
-
the directory to find model-centric tests
controller_tests_dir
-
the directory to find controller-centric tests
view_tests_dir
-
the directory to find view-centric tests
fixtures_dir
-
the directory to find fixtures in
10 11 12 |
# File 'lib/generators/templates/application/merb_stack/autotest/merb.rb', line 10 def model_tests_dir @model_tests_dir end |
#view_tests_dir ⇒ Object
model_tests_dir
-
the directory to find model-centric tests
controller_tests_dir
-
the directory to find controller-centric tests
view_tests_dir
-
the directory to find view-centric tests
fixtures_dir
-
the directory to find fixtures in
10 11 12 |
# File 'lib/generators/templates/application/merb_stack/autotest/merb.rb', line 10 def view_tests_dir @view_tests_dir end |