Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/rss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
# http://www.cozmixng.org/~rwiki/?cmd=view;name=RSS+Parser%3A%3ATutorial.en

module RSS
autoload :Maker, "rss/maker"
end

require "rss/version"
Expand All @@ -85,5 +86,3 @@ module RSS
require "rss/syndication"
require "rss/taxonomy"
require "rss/trackback"

require "rss/maker"
19 changes: 19 additions & 0 deletions test/test-autoload.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: false
require_relative "rss-testcase"

module RSS
class TestAutoload < TestCase
def test_maker_loaded_on_first_use
lib_dir = File.expand_path("../lib", __dir__)
script = <<~SCRIPT
require "rss"
maker_loaded = -> { $LOADED_FEATURES.any? { |path| path.end_with?("/rss/maker.rb") } }
print maker_loaded.call, " "
RSS::Maker
print maker_loaded.call
SCRIPT
output = IO.popen([RbConfig.ruby, "-I", lib_dir, "-e", script], &:read)
assert_equal("false true", output)
end
end
end