Skip to content

Commit

Permalink
Keep compatibility with ruby 1.9.3 and 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iNecas committed Feb 17, 2017
1 parent e64ad16 commit f187614
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@

module Rails4Compatibility
module Testing
def process(*args)
compatible_request(*args) { |*new_args| super(*new_args) }
def process_with_rails4_compat(*args)
compatible_request(*args) { |*new_args| process_without_rails4_compat(*new_args) }
end

def self.included(base)
base.alias_method_chain :process, :rails4_compat
end

def compatible_request(method, action, hash = {})
Expand Down Expand Up @@ -67,4 +71,5 @@ def compatible_request(method, action, hash = {})
end

require 'action_controller/test_case.rb'
ActionController::TestCase::Behavior.prepend(Rails4Compatibility::Testing)
# TODO: replace with prepend once we deprecate ruby 2.0.0
ActionController::TestCase::Behavior.send(:include, Rails4Compatibility::Testing)

0 comments on commit f187614

Please sign in to comment.