2017-08-14 13:08:09 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-06 13:16:09 -04:00
|
|
|
require "abstract_unit"
|
2012-04-28 18:05:49 -04:00
|
|
|
|
|
|
|
class EngineTest < ActiveSupport::TestCase
|
2012-12-28 12:16:26 -05:00
|
|
|
test "reports routes as available only if they're actually present" do
|
2012-04-28 18:05:49 -04:00
|
|
|
engine = Class.new(Rails::Engine) do
|
|
|
|
def initialize(*args)
|
|
|
|
@routes = nil
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-01-25 18:14:09 -05:00
|
|
|
assert_not_predicate engine, :routes?
|
2012-04-28 18:05:49 -04:00
|
|
|
end
|
2014-08-06 21:27:16 -04:00
|
|
|
|
|
|
|
def test_application_can_be_subclassed
|
|
|
|
klass = Class.new(Rails::Application) do
|
|
|
|
attr_reader :hello
|
|
|
|
def initialize
|
|
|
|
@hello = "world"
|
2014-08-07 19:03:09 -04:00
|
|
|
super
|
2014-08-06 21:27:16 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
assert_equal "world", klass.instance.hello
|
|
|
|
end
|
2012-04-28 18:05:49 -04:00
|
|
|
end
|