Module: Workarea::TestCase::Decoration
- Included in:
- GeneratorTest, IntegrationTest, MailerTest, PerformanceTest, SystemTest, Workarea::TestCase, ViewTest
- Defined in:
- lib/workarea/test_case.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.load_decorator(path) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/workarea/test_case.rb', line 7 def self.load_decorator(path) unless loaded_decorators.include?(path) || !File.file?(path) load path loaded_decorators << path end end |
Instance Method Details
#inherited(subclass) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/workarea/test_case.rb', line 14 def inherited(subclass) super absolute_path = caller[0].split(':').first # Don't try to find decorators for classes in the testing gem return if absolute_path.include?('workarea-testing') || absolute_path.include?('workarea/testing') relative_path = absolute_path.match(/(\/test.*)/).to_s decorator_relative = relative_path.gsub( '.rb', ".#{Rails::Decorators.extension}" ) (Plugin.installed.map(&:root) + [Rails.root]).each do |root| decorator_location = [root, decorator_relative].join if File.exist?(decorator_location) TestCase::Decoration.load_decorator(decorator_location) end end end |