Permalink
Browse files

Pass params __FILE__ and __LINE__ + 1 if class_eval with <<

  • Loading branch information...
bogdanvlviv committed May 23, 2017
1 parent 845aabb commit 37fd3d6afb8f7fa184df92e6ce89fa032480605a
Showing with 6 additions and 6 deletions.
  1. +5 −5 actionpack/lib/action_dispatch/journey/route.rb
  2. +1 −1 actionview/lib/action_view/test_case.rb
@@ -10,11 +10,11 @@ class Route
module VerbMatchers
VERBS = %w{ DELETE GET HEAD OPTIONS LINK PATCH POST PUT TRACE UNLINK }
VERBS.each do |v|
class_eval <<-eoc
class #{v}
def self.verb; name.split("::").last; end
def self.call(req); req.#{v.downcase}?; end
end
class_eval <<-eoc, __FILE__, __LINE__ + 1
class #{v}
def self.verb; name.split("::").last; end
def self.call(req); req.#{v.downcase}?; end
end
eoc
end
@@ -71,7 +71,7 @@ def determine_default_helper_class(name)
def helper_method(*methods)
# Almost a duplicate from ActionController::Helpers
methods.flatten.each do |method|
_helpers.module_eval <<-end_eval
_helpers.module_eval <<-end_eval, __FILE__, __LINE__ + 1
def #{method}(*args, &block) # def current_user(*args, &block)
_test_case.send(%(#{method}), *args, &block) # _test_case.send(%(current_user), *args, &block)
end # end

0 comments on commit 37fd3d6

Please sign in to comment.