diff --git a/spec/models/markdowner_spec.rb b/spec/models/markdowner_spec.rb new file mode 100644 index 0000000..3408520 --- /dev/null +++ b/spec/models/markdowner_spec.rb @@ -0,0 +1,44 @@ +require "spec_helper" + +describe Markdowner do + it "parses simple markdown" do + Markdowner.to_html("hello there *italics* and **bold**!").should == + "

hello there italics and bold!

\n" + end + + it "turns @username into a link if @username exists" do + User.make!(:username => "blahblah") + + Markdowner.to_html("hi @blahblah test").should == + "

hi @blahblah test

\n" + + Markdowner.to_html("hi @flimflam test").should == + "

hi @flimflam test

\n" + end + + it "moves punctuation outside of auto-generated links" do + Markdowner.to_html("hi http://example.com/a! test").should == + "

hi http://example.com/a! test

\n" + end + + # bug#209 + it "keeps punctuation inside of auto-generated links when using brackets" do + Markdowner.to_html("hi test").should == + "

hi http://example.com/a. test

\n" + end + + # bug#242 + it "does not expand @ signs inside urls" do + User.make!(:username => "blahblah") + + Markdowner.to_html("hi http://example.com/@blahblah/ test").should == + "

hi http://example.com/@blahblah

\n" + + Markdowner.to_html("hi [test](http://example.com/@blahblah/)").should == + "

hi test

\n" + end +end