diff options
Diffstat (limited to 'railties/test/engine_test.rb')
-rw-r--r-- | railties/test/engine_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/railties/test/engine_test.rb b/railties/test/engine_test.rb new file mode 100644 index 0000000000..68406dce4c --- /dev/null +++ b/railties/test/engine_test.rb @@ -0,0 +1,24 @@ +require 'abstract_unit' + +class EngineTest < ActiveSupport::TestCase + it "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 + + it "does not add more paths to routes on each call" do + engine = Class.new(Rails::Engine) + + engine.routes + length = engine.routes.draw_paths.length + + engine.routes + assert_equal length, engine.routes.draw_paths.length + end +end |