Sha256: d8e907fb28c2bde524d73c6652cbd8e872f63d7091eb5a4f12aae69e829cd5e2
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
require 'test_helper.rb' # # TestClass for Documents # # @author [benny] # class DocumentTest < MiniTest::Unit::TestCase def setup @document = Rack::Blogengine::Document.new @document.title = 'testtitle' @document.path = '/test' @document.date = '20-20-2014' @document.html = '<html><h1>Test</h1></html>' end def test_new_document assert_instance_of(Rack::Blogengine::Document, @document, 'Document should be of class Rack::Blogengine::Document') end def test_document_has_content assert_equal('testtitle', @document.title, 'Document should contain the testtitle') assert_equal('/test', @document.path, 'Document should contain the test path') assert_equal('20-20-2014', @document.date, 'Document should contain the test date') assert_equal('<html><h1>Test</h1></html>', @document.html, 'Document should contain the test html') end def test_document_to_hash hashed = @document.to_hash assert(hashed.key?(:path), 'Hashed Document should contain the path') assert(hashed.key?(:html), 'Hashed Document should contain parsed html') end def test_exec_content_operator cli = Rack::Blogengine::CommandLineInterface.new capture_stdout { cli.generate(testpath) } document = Rack::Blogengine::Document.new document.html = '{% test_operator %}' document.exec_content_operator(document, "#{testpath}") assert_equal('test', document.html, 'Documents html should contain test_operators return value') system("rm -rf #{testpath}") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack-blogengine-0.2.4 | test/rack/blogengine/document_test.rb |
rack-blogengine-0.2.3 | test/rack/blogengine/document_test.rb |