Guest User

Untitled

a guest
Feb 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. def test_unix_config
  2. @paste=@good_paste
  3. @paste.parser=:plaintext
  4. @paste.body=File.read(RAILS_ROOT + "/test/fixtures/pasties/wgetrc")
  5. assert_equal 1, @paste.sections.size
  6. end
  7.  
  8. def test_sections
  9. @paste=@good_paste
  10. @paste.body=File.read(RAILS_ROOT + "/test/fixtures/pasties/sectioned.txt")
  11. @sections=@paste.sections
  12. assert_equal 5, @sections.size
  13.  
  14. assert_equal "test.js", @sections[0].title
  15. assert_equal :javascript, @sections[0].parser
  16. assert_equal "## test.js [javascript]\nThis is a JS file.", @sections[0].body
  17.  
  18. assert_equal "super.rb", @sections[1].title
  19. assert_equal :ruby, @sections[1].parser
  20. assert_equal "## super.rb [ruby]\n\ndef super\n \"i'm super\"\nend", @sections[1].body
  21.  
  22. assert_equal "smart.sql", @sections[2].title
  23. assert_equal :sql, @sections[2].parser
  24.  
  25. assert_equal "just some random title", @sections[3].title
  26. assert_equal @paste.parser.to_sym, @sections[3].parser
  27.  
  28. assert_equal "invalid parser", @sections[4].title
  29. assert_equal @paste.parser.to_sym, @sections[4].parser
  30.  
  31. end
Add Comment
Please, Sign In to add comment