mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
manifest: fix attribution
This commit is contained in:
parent
4ff15dc8ee
commit
5a8f952568
2 changed files with 4 additions and 3 deletions
|
@ -88,7 +88,7 @@ module Docs
|
|||
|
||||
def as_json_extra(store)
|
||||
json = self.as_json
|
||||
json[:attribution] = options[:attribution].strip if self.class.method_defined?(:options) and options[:attribution].present?
|
||||
json[:attribution] = options[:attribution].strip
|
||||
json[:db_size] = store.size(self.db_path) if store.exist?(self.db_path)
|
||||
json[:mtime] = store.mtime(self.meta_path).to_i if store.exist?(self.meta_path)
|
||||
json
|
||||
|
|
|
@ -3,8 +3,9 @@ require 'docs'
|
|||
|
||||
class ManifestTest < MiniTest::Spec
|
||||
let :doc do
|
||||
doc = Class.new Docs::Doc
|
||||
doc = Class.new Docs::Scraper
|
||||
doc.name = 'TestDoc'
|
||||
doc.options[:attribution] = 'foo'
|
||||
doc
|
||||
end
|
||||
|
||||
|
@ -63,7 +64,7 @@ class ManifestTest < MiniTest::Spec
|
|||
it "includes the doc's meta representation" do
|
||||
json = manifest.as_json
|
||||
assert_equal 1, json.length
|
||||
assert_equal "{:name=>\"TestDoc\", :slug=>\"testdoc\", :type=>nil, :mtime=>0}", json[0].to_s
|
||||
assert_equal "{:name=>\"TestDoc\", :slug=>\"testdoc\", :type=>nil, :attribution=>\"foo\", :mtime=>0}", json[0].to_s
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue