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
3module Docs3module Docs
4 class Scraper < Doc4 class Scraper < Doc
5 class << self5 class << self
6 attr_accessor :base_url, :home_url, :root_path, :initial_paths, :options, :html_filters, :text_filters6 attr_accessor :base_url, :root_path, :initial_paths, :options, :html_filters, :text_filters
7 7
8 def inherited(subclass)8 def inherited(subclass)
9 super9 super
@@ -66,7 +66,7 @@ module Docs · 56 unmodified lines
66 end66 end
67 67
68 def home_url68 def home_url
69 @home_url ||= URL.parse self.class.home_url69 @home_url ||= URL.parse self.class.home_url if self.class.home_url
70 end70 end
71 71
72 def root_path72 def root_path
test/lib/docs/core/doc_test.rb+13−0
@@ -60,6 +60,19 @@ class DocsDocTest < MiniTest::Spec · 59 unmodified lines
60 end60 end
61 end61 end
62 62
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
63 describe ".abstract" do76 describe ".abstract" do
64 it "returns nil" do77 it "returns nil" do
65 assert_nil doc.abstract78 assert_nil doc.abstract