Sha256: 9ba05e4728eaa0e66944263c643e11d838386412c2f08d3cd392877ccea1c88b

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require_relative '../test_dummy'

case (Rails::VERSION::MAJOR)
when 2
  if (defined?(ActiveRecord) and defined?(ActiveRecord::Base))
    ActiveRecord::Base.send(:include, TestDummy)
  end
  if (defined?(ActiveSupport) and defined?(ActiveSupport::TestCase))
    ActiveSupport::TestCase.send(:include, TestDummy::TestHelper)
  end
  if (defined?(Test) and defined?(Test::Unit))
    Test::Unit::TestCase.send(:include, TestDummy::TestHelper)
  end
else
  class TestDummy::Railtie < Rails::Railtie
    def self.apply!
      if (defined?(ActiveRecord) and defined?(ActiveRecord::Base))
        ActiveRecord::Base.send(:include, TestDummy)
      end

      if (defined?(ActiveSupport) and defined?(ActiveSupport::TestCase))
        ActiveSupport::TestCase.send(:include, TestDummy::TestHelper)
      end

      if (defined?(Test) and defined?(Test::Unit))
        Test::Unit::TestCase.send(:include, TestDummy::TestHelper)
      end

      if (defined?(MiniTest) and defined?(MiniTest::Unit))
        MiniTest::Unit::TestCase.send(:include, TestDummy::TestHelper)
      end
    end
    
    config.to_prepare do
      TestDummy::Railtie.apply!
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
test_dummy-0.5.0 lib/test_dummy/railtie.rb