History

Make sure that home_url can be nil

Thu Trang Pham committed 11 years ago

Commit 642c1cf1 parent 53bba102 files · +15 −2Browse files

Unified · Split

2 files
  1. lib/docs/core/scraper.rb +2 −2
  2. test/lib/docs/core/doc_test.rb +13 −0
lib/docs/core/scraper.rb+2−2
@@ -3,7 +3,7 @@ require 'set' · 2 unmodified lines
33 module Docs
44 class Scraper < Doc
55 class << self
6− attr_accessor :base_url, :home_url, :root_path, :initial_paths, :options, :html_filters, :text_filters
6+ attr_accessor :base_url, :root_path, :initial_paths, :options, :html_filters, :text_filters
77
88 def inherited(subclass)
99 super
@@ -66,7 +66,7 @@ module Docs · 56 unmodified lines
6666 end
6767
6868 def home_url
69− @home_url ||= URL.parse self.class.home_url
69+ @home_url ||= URL.parse self.class.home_url if self.class.home_url
7070 end
7171
7272 def root_path
test/lib/docs/core/doc_test.rb+13−0
@@ -60,6 +60,19 @@ class DocsDocTest < MiniTest::Spec · 59 unmodified lines
6060 end
6161 end
6262
63+ describe ".home_url" do
64+ it "returns nil" do
65+ assert_nil doc.home_url
66+ end
67+ end
68+
69+ describe ".home_url=" do
70+ it "stores .home_url" do
71+ doc.home_url = 'http://www.url.com/doc'
72+ assert_equal 'http://www.url.com/doc', doc.home_url
73+ end
74+ end
75+
6376 describe ".abstract" do
6477 it "returns nil" do
6578 assert_nil doc.abstract