require 'spec_helper' describe Diaspora::Markdownify::Email do describe '#preprocess' do before do @html = Diaspora::Markdownify::Email.new end it 'should autolink a hashtag' do markdownified = @html.preprocess("#tag") expect(markdownified).to eq("[#tag](http://localhost:9887/tags/tag)") end it 'should autolink multiple hashtags' do markdownified = @html.preprocess("oh #l #loL") expect(markdownified).to eq("oh [#l](http://localhost:9887/tags/l) [#loL](http://localhost:9887/tags/lol)") end it 'should not autolink headers' do markdownified = @html.preprocess("# header") expect(markdownified).to eq("# header") end end describe "Markdown rendering" do before do @markdown = Redcarpet::Markdown.new(Diaspora::Markdownify::Email) @sample_text = "# Header\n\n#messages containing #hashtags should render properly" end it 'should render the message' do rendered = @markdown.render(@sample_text).strip expect(rendered).to eq("