Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- context "a paste with sections" do
- setup do
- @paste=Paste.new
- @paste.parser=:plaintext
- end
- specify "should not trigger sections for repeat ## lines" do
- @paste.body=File.read(RAILS_ROOT + "/test/fixtures/pasties/wgetrc")
- @paste.sections.size.should_equal 1
- end
- specify "should be divided at ## markers" do
- @paste.body=File.read(RAILS_ROOT + "/test/fixtures/pasties/sectioned.txt")
- @sections=@paste.sections
- @sections.size.should_equal 5
- @sections.map { |s| s.title }.should_equal ["test.js", "super.rb", "smart.sql", "just some random title", "invalid parser"]
- @sections.map { |s| s.parser}.should_equal [ :javascript, :ruby, :sql, :plaintext, :plaintext]
- @sections[0].body.should_equal "## test.js [javascript]\nThis is a JS file."
- @sections[1].body.should_equal "## super.rb [ruby]\n\ndef super\n \"i'm super\"\nend"
- end
- end
Add Comment
Please, Sign In to add comment