Guest User

Untitled

a guest
Feb 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. context "a paste with sections" do
  2.  
  3. setup do
  4. @paste=Paste.new
  5. @paste.parser=:plaintext
  6. end
  7.  
  8. specify "should not trigger sections for repeat ## lines" do
  9. @paste.body=File.read(RAILS_ROOT + "/test/fixtures/pasties/wgetrc")
  10. @paste.sections.size.should_equal 1
  11. end
  12.  
  13. specify "should be divided at ## markers" do
  14. @paste.body=File.read(RAILS_ROOT + "/test/fixtures/pasties/sectioned.txt")
  15. @sections=@paste.sections
  16. @sections.size.should_equal 5
  17.  
  18. @sections.map { |s| s.title }.should_equal ["test.js", "super.rb", "smart.sql", "just some random title", "invalid parser"]
  19. @sections.map { |s| s.parser}.should_equal [ :javascript, :ruby, :sql, :plaintext, :plaintext]
  20. @sections[0].body.should_equal "## test.js [javascript]\nThis is a JS file."
  21. @sections[1].body.should_equal "## super.rb [ruby]\n\ndef super\n \"i'm super\"\nend"
  22. end
  23.  
  24. end
Add Comment
Please, Sign In to add comment