Merge remote-tracking branch 'upstream/pull/3543'
This commit is contained in:
commit
407287512f
4 changed files with 23 additions and 4 deletions
|
@ -25,4 +25,8 @@ class IssueComment < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
validates :body, :presence => true, :characters => true
|
validates :body, :presence => true, :characters => true
|
||||||
|
|
||||||
|
def body
|
||||||
|
RichText.new("markdown", self[:body])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<%= t ".comment_from_html", :user_link => link_to(comment.user.display_name, user_path(comment.user)),
|
<%= t ".comment_from_html", :user_link => link_to(comment.user.display_name, user_path(comment.user)),
|
||||||
:comment_created_at => l(comment.created_at.to_datetime, :format => :friendly) %>
|
:comment_created_at => l(comment.created_at.to_datetime, :format => :friendly) %>
|
||||||
</p>
|
</p>
|
||||||
<p><%= comment.body %></p>
|
<p><%= comment.body.to_html %></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
8
test/factories/issue_comment.rb
Normal file
8
test/factories/issue_comment.rb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
FactoryBot.define do
|
||||||
|
factory :issue_comment do
|
||||||
|
sequence(:body) { |n| "This is issue comment #{n}" }
|
||||||
|
|
||||||
|
issue
|
||||||
|
user
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,7 +1,14 @@
|
||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
class IssueCommentTest < ActiveSupport::TestCase
|
class IssueCommentTest < ActiveSupport::TestCase
|
||||||
# test "the truth" do
|
test "body must be present" do
|
||||||
# assert true
|
comment = build(:issue_comment, :body => "")
|
||||||
# end
|
assert_not comment.valid?
|
||||||
|
assert_not_nil comment.errors[:body]
|
||||||
|
end
|
||||||
|
|
||||||
|
test "body" do
|
||||||
|
comment = create(:issue_comment)
|
||||||
|
assert_instance_of(RichText::Markdown, comment.body)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue