Class: InfinityTest::ApplicationLibrary::Rails
- Inherits:
-
Object
- Object
- InfinityTest::ApplicationLibrary::Rails
- Includes:
- HeuristicsHelper
- Defined in:
- lib/infinity_test/application_library/rails.rb
Instance Attribute Summary collapse
-
#application_controller_pattern ⇒ Object
Returns the value of attribute application_controller_pattern.
-
#application_helper_pattern ⇒ Object
Returns the value of attribute application_helper_pattern.
-
#configuration_pattern ⇒ Object
Returns the value of attribute configuration_pattern.
-
#controllers_pattern ⇒ Object
Returns the value of attribute controllers_pattern.
-
#fixtures_pattern ⇒ Object
Returns the value of attribute fixtures_pattern.
-
#helpers_pattern ⇒ Object
Returns the value of attribute helpers_pattern.
-
#lib_pattern ⇒ Object
Returns the value of attribute lib_pattern.
-
#mailers_pattern ⇒ Object
Returns the value of attribute mailers_pattern.
-
#models_pattern ⇒ Object
Returns the value of attribute models_pattern.
-
#routes_pattern ⇒ Object
Returns the value of attribute routes_pattern.
-
#test_pattern ⇒ Object
Returns the value of attribute test_pattern.
Instance Method Summary collapse
- #add_heuristics! ⇒ Object
-
#initialize ⇒ Rails
constructor
A new instance of Rails.
- #resolve_patterns! ⇒ Object
Methods included from HeuristicsHelper
Constructor Details
#initialize ⇒ Rails
Returns a new instance of Rails.
17 18 19 20 |
# File 'lib/infinity_test/application_library/rails.rb', line 17 def initialize @application = InfinityTest.application resolve_patterns! end |
Instance Attribute Details
#application_controller_pattern ⇒ Object
Returns the value of attribute application_controller_pattern.
5 6 7 |
# File 'lib/infinity_test/application_library/rails.rb', line 5 def application_controller_pattern @application_controller_pattern end |
#application_helper_pattern ⇒ Object
Returns the value of attribute application_helper_pattern.
5 6 7 |
# File 'lib/infinity_test/application_library/rails.rb', line 5 def application_helper_pattern @application_helper_pattern end |
#configuration_pattern ⇒ Object
Returns the value of attribute configuration_pattern.
5 6 7 |
# File 'lib/infinity_test/application_library/rails.rb', line 5 def configuration_pattern @configuration_pattern end |
#controllers_pattern ⇒ Object
Returns the value of attribute controllers_pattern.
5 6 7 |
# File 'lib/infinity_test/application_library/rails.rb', line 5 def controllers_pattern @controllers_pattern end |
#fixtures_pattern ⇒ Object
Returns the value of attribute fixtures_pattern.
5 6 7 |
# File 'lib/infinity_test/application_library/rails.rb', line 5 def fixtures_pattern @fixtures_pattern end |
#helpers_pattern ⇒ Object
Returns the value of attribute helpers_pattern.
5 6 7 |
# File 'lib/infinity_test/application_library/rails.rb', line 5 def helpers_pattern @helpers_pattern end |
#lib_pattern ⇒ Object
Returns the value of attribute lib_pattern.
5 6 7 |
# File 'lib/infinity_test/application_library/rails.rb', line 5 def lib_pattern @lib_pattern end |
#mailers_pattern ⇒ Object
Returns the value of attribute mailers_pattern.
5 6 7 |
# File 'lib/infinity_test/application_library/rails.rb', line 5 def mailers_pattern @mailers_pattern end |
#models_pattern ⇒ Object
Returns the value of attribute models_pattern.
5 6 7 |
# File 'lib/infinity_test/application_library/rails.rb', line 5 def models_pattern @models_pattern end |
#routes_pattern ⇒ Object
Returns the value of attribute routes_pattern.
5 6 7 |
# File 'lib/infinity_test/application_library/rails.rb', line 5 def routes_pattern @routes_pattern end |
#test_pattern ⇒ Object
Returns the value of attribute test_pattern.
5 6 7 |
# File 'lib/infinity_test/application_library/rails.rb', line 5 def test_pattern @test_pattern end |
Instance Method Details
#add_heuristics! ⇒ Object
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 |
# File 'lib/infinity_test/application_library/rails.rb', line 22 def add_heuristics! rails = self heuristics do add(rails.application_controller_pattern) do |file| run :all => :tests, :in_dir => :controllers end add(rails.application_helper_pattern) do |file| run :all => :tests, :in_dir => [:helpers, :views] end add(rails.configuration_pattern) do |file| run(:all => :tests) end add(rails.routes_pattern) do |file| run(:all => :tests) end add(rails.controllers_pattern) do |file| run :test_for => file, :in_dir => :controllers end add(rails.models_pattern) do |file| run :test_for => file, :in_dir => :models end add(rails.helpers_pattern) do |file| run :test_for => file, :in_dir => :helpers end add(rails.mailers_pattern) do |file| run :test_for => file, :in_dir => :mailers end add(rails.lib_pattern) do |file| run :test_for => file, :in_dir => :lib end add(rails.test_pattern) do |file| run file end add(rails.fixtures_pattern) do |file| run :all => :tests, :in_dir => :models end end end |
#resolve_patterns! ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/infinity_test/application_library/rails.rb', line 73 def resolve_patterns! @configuration_pattern = "^config/application.rb" @routes_pattern = "^config/routes\.rb" @lib_pattern = "^lib/*/(.*)\.rb" if @application.using_test_unit? @test_pattern = "^test/*/(.*)_test.rb" @fixtures_pattern = "^test/fixtures/(.*).yml" else @test_pattern = "^spec/*/(.*)_spec.rb" @fixtures_pattern = "^spec/fixtures/(.*).yml" end @controllers_pattern = "^app/controllers/(.*)\.rb" @models_pattern = "^app/models/(.*)\.rb" @helpers_pattern = "^app/helpers/(.*)\.rb" @mailers_pattern = "^app/mailers/(.*)\.rb" @application_controller_pattern = "^app/controllers/application_controller.rb" @application_helper_pattern = "^app/helpers/application_helper.rb" end |