Fix invalid body_markdown in article with video (#4258) [ci skip]

This commit is contained in:
Araslanov Evgeny 2019-10-08 22:41:44 +03:00 committed by Mac Siri
parent 81e3f65965
commit 60d8a07276
3 changed files with 4 additions and 10 deletions

View file

@ -56,7 +56,7 @@ class ArticlesController < ApplicationController
elsif @tag.present?
skip_authorization
Article.new(
body_markdown: "---\ntitle: \npublished: false\ndescription: \ntags: " + @tag.name + "\n---\n\n",
body_markdown: "---\ntitle: \npublished: false\ndescription: \ntags: #{@tag.name}\n---\n\n",
processed_html: "", user_id: current_user&.id
)
else

View file

@ -32,15 +32,8 @@ class ArticleWithVideoCreationService
def initial_article_with_params(article)
if @current_user.editor_version == "v1"
article.body_markdown = <<~BODY
---
title: Unpublished Video ~ #{rand(100_000).to_s(26)}
published: false
description:
tags:
---
BODY
title = "Unpublished Video ~ #{rand(100_000).to_s(26)}"
article.body_markdown = "---\ntitle: #{title}\npublished: false\ndescription: \ntags: \n---\n\n"
else
article.body_markdown = ""
article.title = "Unpublished Video ~ #{rand(100_000).to_s(26)}"

View file

@ -14,6 +14,7 @@ RSpec.describe ArticleWithVideoCreationService, type: :service do
Timecop.return
test = build_stubbed(:article, user: user, video: link).attributes.symbolize_keys
article = described_class.new(test, user).create!
expect(article.body_markdown.inspect).to include("description: \\ntags: \\n")
expect(article.video_state).to eq("PROGRESSING")
end
end