Sha256: 25a15f8ac19eb519c1fd2f5fd171e8aba7a1fe4bd8a223c4eacf7856d51ec3fa

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require 'new_relic/control/frameworks/rails'
require 'new_relic/control/frameworks/rails3'
require 'new_relic/control/frameworks/rails4'

if defined?(::Rails)
  parent_class = case ::Rails::VERSION::MAJOR.to_i
  when 4
    NewRelic::Control::Frameworks::Rails4
  when 3
    NewRelic::Control::Frameworks::Rails3
  end
end
parent_class ||= NewRelic::Control::Frameworks::Rails

class NewRelic::Control::Frameworks::Test < parent_class
  def env
    'test'
  end

  def app
    if defined?(::Rails::VERSION)
      if ::Rails::VERSION::MAJOR.to_i == 4
        :rails4
      elsif ::Rails::VERSION::MAJOR.to_i == 3
        :rails3
      else
        :rails
      end
    end
  end

  # Add the default route in case it's missing.  Need it for testing.
  def install_devmode_route
    super
    ActionController::Routing::RouteSet.class_eval do
      return if defined? draw_without_test_route
      def draw_with_test_route
        draw_without_test_route do | map |
          map.connect ':controller/:action/:id'
          yield map
        end
      end
      alias_method_chain :draw, :test_route
    end
    # Force the routes to be reloaded
    ActionController::Routing::Routes.reload!
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
newrelic_rpm-3.6.2.96 test/config/test_control.rb
newrelic_rpm-3.6.2.90.beta test/config/test_control.rb
newrelic_rpm-3.6.1.88 test/config/test_control.rb
newrelic_rpm-3.6.1.87 test/config/test_control.rb
newrelic_rpm-3.6.1.86.beta test/config/test_control.rb
newrelic_rpm-3.6.1.85.beta test/config/test_control.rb