Sha256: 9b5f82978b1e27fdf4671d125e263ecc99b58adcea080345972313890f82173b

Contents?: true

Size: 1.37 KB

Versions: 65

Compression:

Stored size: 1.37 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) && defined?(::Rails::VERSION)
      if ::Rails::VERSION::MAJOR.to_i == 4
        :rails4
      elsif ::Rails::VERSION::MAJOR.to_i == 3
        :rails3
      else
        :rails
      end
    else
      :test
    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

65 entries across 65 versions & 2 rubygems

Version Path
newrelic_rpm-4.1.0.333 test/config/test_control.rb
newrelic_rpm-4.0.0.332 test/config/test_control.rb
newrelic_rpm-3.18.1.330 test/config/test_control.rb
newrelic_rpm-3.18.0.329 test/config/test_control.rb
newrelic_rpm-3.17.2.327 test/config/test_control.rb
newrelic_rpm-3.17.1.326 test/config/test_control.rb
newrelic_rpm-3.17.0.325 test/config/test_control.rb
newrelic_rpm-3.16.3.323 test/config/test_control.rb
newrelic_rpm-3.16.2.321 test/config/test_control.rb
newrelic_rpm-3.16.1.320 test/config/test_control.rb
newrelic_rpm-3.16.0.318 test/config/test_control.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/test/config/test_control.rb
newrelic_rpm-3.15.2.317 test/config/test_control.rb
newrelic_rpm-3.15.1.316 test/config/test_control.rb
newrelic_rpm-3.15.0.314 test/config/test_control.rb
newrelic_rpm-3.14.3.313 test/config/test_control.rb
newrelic_rpm-3.14.2.312 test/config/test_control.rb
newrelic_rpm-3.14.1.311 test/config/test_control.rb
newrelic_rpm-3.14.0.305 test/config/test_control.rb
newrelic_rpm-3.13.2.302 test/config/test_control.rb