Loading app/helpers/notifier_helper.rb +1 −1 Original line number Original line Diff line number Diff line Loading @@ -5,7 +5,7 @@ module NotifierHelper # @return [String] The formatted post. # @return [String] The formatted post. def post_message(post, opts={}) def post_message(post, opts={}) if post.respond_to? :message if post.respond_to? :message post.message.plain_text_without_markdown post.message.try(:plain_text_without_markdown) || post_page_title(post) else else I18n.translate 'notifier.a_post_you_shared' I18n.translate 'notifier.a_post_you_shared' end end Loading spec/helpers/notifier_helper_spec.rb +7 −0 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,13 @@ describe NotifierHelper, :type => :helper do it 'strip markdown in the post' do it 'strip markdown in the post' do expect(post_message(@markdown_post)).to eq(@striped_markdown_post) expect(post_message(@markdown_post)).to eq(@striped_markdown_post) end end it "falls back to the title, if the root post was deleted" do reshare = FactoryGirl.create(:reshare) reshare.root.destroy expect(helper.post_message(Reshare.find(reshare.id))) .to eq(I18n.t("posts.show.reshare_by", author: reshare.author_name)) end end end describe '#comment_message' do describe '#comment_message' do Loading Loading
app/helpers/notifier_helper.rb +1 −1 Original line number Original line Diff line number Diff line Loading @@ -5,7 +5,7 @@ module NotifierHelper # @return [String] The formatted post. # @return [String] The formatted post. def post_message(post, opts={}) def post_message(post, opts={}) if post.respond_to? :message if post.respond_to? :message post.message.plain_text_without_markdown post.message.try(:plain_text_without_markdown) || post_page_title(post) else else I18n.translate 'notifier.a_post_you_shared' I18n.translate 'notifier.a_post_you_shared' end end Loading
spec/helpers/notifier_helper_spec.rb +7 −0 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,13 @@ describe NotifierHelper, :type => :helper do it 'strip markdown in the post' do it 'strip markdown in the post' do expect(post_message(@markdown_post)).to eq(@striped_markdown_post) expect(post_message(@markdown_post)).to eq(@striped_markdown_post) end end it "falls back to the title, if the root post was deleted" do reshare = FactoryGirl.create(:reshare) reshare.root.destroy expect(helper.post_message(Reshare.find(reshare.id))) .to eq(I18n.t("posts.show.reshare_by", author: reshare.author_name)) end end end describe '#comment_message' do describe '#comment_message' do Loading