Optionally include 'release' and 'links' in docs manifest

pull/308/merge
Thibaut Courouble 9 years ago
parent a639aedcd9
commit bd6e27eca2

@ -33,11 +33,10 @@ module Docs
end
def as_json
{ name: name,
slug: slug,
type: type,
release: release,
links: links }
json = { name: name, slug: slug, type: type }
json[:links] = links if links.present?
json[:release] = release if release.present?
json
end
def store_page(store, id)

@ -116,6 +116,8 @@ class DocsDocTest < MiniTest::Spec
end
it "includes the doc's name, slug, type, and release" do
assert_equal %i(name slug type), doc.as_json.keys
%w(name slug type release links).each do |attribute|
eval "stub(doc).#{attribute} { attribute }"
assert_equal attribute, doc.as_json[attribute.to_sym]

Loading…
Cancel
Save