Skip to content

Commit

Permalink
Change how helpers are loaded in TestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
tagliala committed Feb 4, 2016
1 parent 6d1a9ff commit c33464f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Expand Up @@ -22,7 +22,7 @@ Metrics/MethodLength:
Max: 24

Metrics/ModuleLength:
Max: 128 # TODO: Lower to 100
Max: 129 # TODO: Lower to 100

Metrics/ParameterLists:
Max: 8
Expand Down
5 changes: 3 additions & 2 deletions lib/route_translator/translator.rb
Expand Up @@ -36,8 +36,9 @@ def self.add_untranslated_helpers_to_controllers_and_views(old_name, named_route
end

def self.add_helpers_to_test_cases(helper_container)
[ActionController::TestCase, ActionMailer::TestCase, ActionView::TestCase].each do |klass|
klass.__send__(:include, helper_container)
%w(ActionController ActionMailer ActionView).each do |klass_name|
next unless Module.const_defined?(klass_name)
klass_name.constantize::TestCase.__send__(:include, helper_container)
end
end

Expand Down
5 changes: 3 additions & 2 deletions test/support/routes_helper.rb
Expand Up @@ -5,8 +5,9 @@ def draw_routes(&block)
if @routes.respond_to?(:install_helpers)
@routes.install_helpers
else
[ActionController::Base, ActionMailer::Base, ActionView::Base].each do |klass|
klass.__send__(:include, @routes.url_helpers)
%w(ActionController ActionMailer ActionView).each do |klass_name|
next unless Module.const_defined?(klass_name)
klass_name.constantize::Base.__send__(:include, @routes.url_helpers)
end
end
end
Expand Down

0 comments on commit c33464f

Please sign in to comment.