aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/engine_test.rb
blob: 19379e200c01d26dce8a1f159c6115247e70f087 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

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_not_predicate 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