diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-08-06 18:27:16 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-08-06 18:27:16 -0700 |
commit | d25fe31c40928712b5e08fe0afb567c3bc88eddf (patch) | |
tree | 3b1134d5042c227cd1a02698f90dc96849751b69 /railties/test | |
parent | 2090615d39c071c9eb25e715275eb79f3f9b6266 (diff) | |
download | rails-d25fe31c40928712b5e08fe0afb567c3bc88eddf.tar.gz rails-d25fe31c40928712b5e08fe0afb567c3bc88eddf.tar.bz2 rails-d25fe31c40928712b5e08fe0afb567c3bc88eddf.zip |
lazily instantiate application subclasses
this means we can meaningfully override methods in the subclass
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/engine_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/railties/test/engine_test.rb b/railties/test/engine_test.rb index 7970913d21..8401494bd2 100644 --- a/railties/test/engine_test.rb +++ b/railties/test/engine_test.rb @@ -11,4 +11,14 @@ class EngineTest < ActiveSupport::TestCase assert !engine.routes? end + + def test_application_can_be_subclassed + klass = Class.new(Rails::Application) do + attr_reader :hello + def initialize + @hello = "world" + end + end + assert_equal "world", klass.instance.hello + end end |