Skip to content

Commit

Permalink
Fix invalid body_markdown in article with video (#4258) [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
araslanov-e authored and maestromac committed Oct 8, 2019
1 parent 81e3f65 commit 60d8a07
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/controllers/articles_controller.rb
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ def new
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
11 changes: 2 additions & 9 deletions app/services/article_with_video_creation_service.rb
Original file line number Diff line number Diff line change
@@ -32,15 +32,8 @@ def create!

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)}"
1 change: 1 addition & 0 deletions spec/services/article_with_video_creation_service_spec.rb
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
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

0 comments on commit 60d8a07

Please sign in to comment.