aboutsummaryrefslogblamecommitdiffstats
path: root/railties/test/engine_test.rb
blob: 248afa2d2cfbb0b6968acc15f90a57df3b1d3b97 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
                       

                                          
                                                                        








                                        





                                            
             



                                              
   
require "abstract_unit"

class EngineTest < ActiveSupport::TestCase
  test "reports routes as available only if they're actually present" do
    engine = Class.new(Rails::Engine) do
      def initialize(*args)
        @routes = nil
        super
      end
    end

    assert !engine.routes?
  end

  def test_application_can_be_subclassed
    klass = Class.new(Rails::Application) do
      attr_reader :hello
      def initialize
        @hello = "world"
        super
      end
    end
    assert_equal "world", klass.instance.hello
  end
end