spec/murdoc/annotator_spec.rb in murdoc-0.1.7 vs spec/murdoc/annotator_spec.rb in murdoc-0.1.8

- old
+ new

@@ -81,11 +81,10 @@ it "should not hang upon non-closed comments" do source = "=begin\n" lambda { subject = described_class.new(source, :ruby) - subject.source = source }.should_not raise_error end end context "for comment without code" do @@ -101,9 +100,17 @@ let(:source) { "# :code:\n# def hello\n# end\n\n\# Comment\ndef hi\nend" } it "should not create paragraphs" do subject.should have_exactly(1).paragraphs subject.paragraphs[0].source.should == "def hi\nend" subject.paragraphs[0].annotation.should == "Comment" + end + + it "should not swallow wrong code" do + source = "# :code:\n# def hi\n# end\n\ndef hallo\nend" + subject = described_class.new(source, :ruby) + subject.should have_exactly(1).paragraphs + subject.paragraphs[0].annotation.to_s.should == "" + subject.paragraphs[0].source.should == "def hallo\nend" end end it "should not choke on edge cases" do subject.source = "" \ No newline at end of file