mbrao 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/doc/ActionView/Template/Handlers/MbraoTemplate.html +1 -1
- data/doc/ActionView/Template/Handlers.html +1 -1
- data/doc/HTML/Pipeline/KramdownFilter.html +1 -1
- data/doc/HTML/Pipeline.html +1 -1
- data/doc/HTML.html +1 -1
- data/doc/Mbrao/Author.html +1 -1
- data/doc/Mbrao/Content.html +958 -259
- data/doc/Mbrao/ContentPublicInterface.html +1 -1
- data/doc/Mbrao/Exceptions/InvalidDate.html +1 -1
- data/doc/Mbrao/Exceptions/InvalidMetadata.html +1 -1
- data/doc/Mbrao/Exceptions/Parsing.html +1 -1
- data/doc/Mbrao/Exceptions/Rendering.html +1 -1
- data/doc/Mbrao/Exceptions/UnavailableLocalization.html +1 -1
- data/doc/Mbrao/Exceptions/Unimplemented.html +1 -1
- data/doc/Mbrao/Exceptions/UnknownEngine.html +1 -1
- data/doc/Mbrao/Exceptions.html +1 -1
- data/doc/Mbrao/Parser.html +1 -1
- data/doc/Mbrao/ParsingEngines/Base.html +1 -1
- data/doc/Mbrao/ParsingEngines/PlainText.html +1 -1
- data/doc/Mbrao/ParsingEngines.html +1 -1
- data/doc/Mbrao/PublicInterface/ClassMethods.html +1 -1
- data/doc/Mbrao/PublicInterface.html +1 -1
- data/doc/Mbrao/RenderingEngines/Base.html +1 -1
- data/doc/Mbrao/RenderingEngines/HtmlPipeline.html +1 -1
- data/doc/Mbrao/RenderingEngines.html +1 -1
- data/doc/Mbrao/Validations/ClassMethods.html +1 -1
- data/doc/Mbrao/Validations.html +1 -1
- data/doc/Mbrao/Version.html +2 -2
- data/doc/Mbrao.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +53 -47
- data/doc/top-level-namespace.html +1 -1
- data/lib/mbrao/content.rb +18 -8
- data/lib/mbrao/version.rb +1 -1
- data/spec/mbrao/content_spec.rb +10 -2
- metadata +1 -1
data/spec/mbrao/content_spec.rb
CHANGED
@@ -130,6 +130,10 @@ describe Mbrao::Content do
|
|
130
130
|
it_should_behave_like "localized setter", :title
|
131
131
|
end
|
132
132
|
|
133
|
+
describe "#summary=" do
|
134
|
+
it_should_behave_like "localized setter", :summary
|
135
|
+
end
|
136
|
+
|
133
137
|
describe "#body=" do
|
134
138
|
it "should set the content as string" do
|
135
139
|
subject.body = "A"
|
@@ -253,13 +257,14 @@ describe Mbrao::Content do
|
|
253
257
|
describe "#as_json" do
|
254
258
|
subject {
|
255
259
|
@created_at = DateTime.civil(1984, 7, 7, 11, 30, 0)
|
256
|
-
metadata = {"uid" => "UID", "title" => {it: "IT", en: "EN"}, "author" => "AUTHOR", "tags" => {it: "IT", en: "EN"}, "more" => "MORE", created_at: @created_at, locales: ["it", ["en"]], other: ["OTHER"]}
|
260
|
+
metadata = {"uid" => "UID", "title" => {it: "IT", en: "EN"}, "summary" => "SUMMARY", "author" => "AUTHOR", "tags" => {it: "IT", en: "EN"}, "more" => "MORE", created_at: @created_at, locales: ["it", ["en"]], other: ["OTHER"]}
|
257
261
|
::Mbrao::Content.create(metadata, "BODY")
|
258
262
|
}
|
259
263
|
|
260
264
|
it "should return the content as a JSON hash" do
|
261
265
|
expect(subject.as_json).to eq({
|
262
266
|
"author" => {"uid" => nil, "name" => "AUTHOR", "email" => nil, "website" => nil, "image" => nil, "metadata" => {}},
|
267
|
+
"summary" => "SUMMARY",
|
263
268
|
"body" => "BODY",
|
264
269
|
"created_at" => @created_at,
|
265
270
|
"locales" => ["it", "en"],
|
@@ -274,6 +279,7 @@ describe Mbrao::Content do
|
|
274
279
|
|
275
280
|
it "should filter out keys if asked to" do
|
276
281
|
expect(subject.as_json(exclude: [:author, :uid])).to eq({
|
282
|
+
"summary" => "SUMMARY",
|
277
283
|
"body" => "BODY",
|
278
284
|
"created_at" => @created_at,
|
279
285
|
"locales" => ["it", "en"],
|
@@ -290,6 +296,7 @@ describe Mbrao::Content do
|
|
290
296
|
subject.uid = nil
|
291
297
|
|
292
298
|
expect(subject.as_json(exclude_empty: true)).to eq({
|
299
|
+
"summary" => "SUMMARY",
|
293
300
|
"body" => "BODY",
|
294
301
|
"created_at" => @created_at,
|
295
302
|
"locales" => ["it", "en"],
|
@@ -313,11 +320,12 @@ describe Mbrao::Content do
|
|
313
320
|
|
314
321
|
it "should assign metadata if present" do
|
315
322
|
created_at = DateTime.civil(1984, 7, 7, 11, 30, 0)
|
316
|
-
metadata = {"uid" => "UID", "title" => {it: "IT", en: "EN"}, "author" => "AUTHOR", "tags" => {it: "IT", en: "EN"}, "more" => "MORE", created_at: created_at, locales: ["it", ["en"]], other: ["OTHER"]}
|
323
|
+
metadata = {"uid" => "UID", "title" => {it: "IT", en: "EN"}, "summary" => {it: "IT", en: "EN"}, "author" => "AUTHOR", "tags" => {it: "IT", en: "EN"}, "more" => "MORE", created_at: created_at, locales: ["it", ["en"]], other: ["OTHER"]}
|
317
324
|
content = ::Mbrao::Content.create(metadata, "BODY")
|
318
325
|
|
319
326
|
expect(content.uid).to eq("UID")
|
320
327
|
expect(content.title).to eq({"it" => "IT", "en" => "EN"})
|
328
|
+
expect(content.summary).to eq({"it" => "IT", "en" => "EN"})
|
321
329
|
expect(content.author).to be_a(::Mbrao::Author)
|
322
330
|
expect(content.author.name).to eq("AUTHOR")
|
323
331
|
expect(content.body).to eq("BODY")
|