This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
require "test_helper"
|
||||
|
||||
class DocumentTest < Minitest::Test
|
||||
include EzdocTestHelpers
|
||||
include NotareTestHelpers
|
||||
|
||||
def test_creates_valid_docx_structure
|
||||
Tempfile.create(["test", ".docx"]) do |file|
|
||||
Ezdoc::Document.create(file.path) do |doc|
|
||||
Notare::Document.create(file.path) do |doc|
|
||||
doc.p "Test"
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ class DocumentTest < Minitest::Test
|
||||
|
||||
def test_empty_document
|
||||
Tempfile.create(["test", ".docx"]) do |file|
|
||||
Ezdoc::Document.create(file.path) { |_doc| } # rubocop:disable Lint/EmptyBlock
|
||||
Notare::Document.create(file.path) { |_doc| } # rubocop:disable Lint/EmptyBlock
|
||||
|
||||
assert File.exist?(file.path)
|
||||
Zip::File.open(file.path) do |zip|
|
||||
@@ -45,30 +45,30 @@ class DocumentTest < Minitest::Test
|
||||
def test_document_create_returns_document
|
||||
result = nil
|
||||
Tempfile.create(["test", ".docx"]) do |file|
|
||||
result = Ezdoc::Document.create(file.path) do |doc|
|
||||
result = Notare::Document.create(file.path) do |doc|
|
||||
doc.p "Test"
|
||||
end
|
||||
end
|
||||
|
||||
assert_instance_of Ezdoc::Document, result
|
||||
assert_instance_of Notare::Document, result
|
||||
end
|
||||
|
||||
def test_document_has_nodes
|
||||
doc = Ezdoc::Document.new
|
||||
doc = Notare::Document.new
|
||||
doc.p "Test"
|
||||
|
||||
assert_equal 1, doc.nodes.count
|
||||
assert_instance_of Ezdoc::Nodes::Paragraph, doc.nodes.first
|
||||
assert_instance_of Notare::Nodes::Paragraph, doc.nodes.first
|
||||
end
|
||||
|
||||
def test_document_lists_helper
|
||||
doc = Ezdoc::Document.new
|
||||
doc = Notare::Document.new
|
||||
doc.p "Paragraph"
|
||||
doc.ul { doc.li "Bullet" }
|
||||
doc.ol { doc.li "Number" }
|
||||
doc.table { doc.tr { doc.td "Cell" } }
|
||||
|
||||
assert_equal 2, doc.lists.count
|
||||
assert(doc.lists.all? { |l| l.is_a?(Ezdoc::Nodes::List) })
|
||||
assert(doc.lists.all? { |l| l.is_a?(Notare::Nodes::List) })
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user