Make sure that home_url can be nil

pull/170/head
Thu Trang Pham 10 years ago
parent 53bba10212
commit 642c1cff7d

@ -3,7 +3,7 @@ require 'set'
module Docs
class Scraper < Doc
class << self
attr_accessor :base_url, :home_url, :root_path, :initial_paths, :options, :html_filters, :text_filters
attr_accessor :base_url, :root_path, :initial_paths, :options, :html_filters, :text_filters
def inherited(subclass)
super
@ -66,7 +66,7 @@ module Docs
end
def home_url
@home_url ||= URL.parse self.class.home_url
@home_url ||= URL.parse self.class.home_url if self.class.home_url
end
def root_path

@ -60,6 +60,19 @@ class DocsDocTest < MiniTest::Spec
end
end
describe ".home_url" do
it "returns nil" do
assert_nil doc.home_url
end
end
describe ".home_url=" do
it "stores .home_url" do
doc.home_url = 'http://www.url.com/doc'
assert_equal 'http://www.url.com/doc', doc.home_url
end
end
describe ".abstract" do
it "returns nil" do
assert_nil doc.abstract

Loading…
Cancel
Save