Initial project setup

This commit is contained in:
2025-12-02 10:23:52 +01:00
commit 50c9c20eca
16 changed files with 340 additions and 0 deletions

28
test/ezdoc_test.rb Normal file
View File

@@ -0,0 +1,28 @@
# frozen_string_literal: true
require "test_helper"
require "tempfile"
require "zip"
class EzdocTest < Minitest::Test
def test_creates_valid_docx_with_hello_world
Tempfile.create(["test", ".docx"]) do |file|
Ezdoc::Document.create(file.path) do |doc|
doc.text "Hello World"
end
assert File.exist?(file.path)
assert File.size(file.path).positive?
Zip::File.open(file.path) do |zip|
assert zip.find_entry("[Content_Types].xml")
assert zip.find_entry("_rels/.rels")
assert zip.find_entry("word/document.xml")
assert zip.find_entry("word/_rels/document.xml.rels")
document_xml = zip.read("word/document.xml")
assert_includes document_xml, "Hello World"
end
end
end
end

5
test/test_helper.rb Normal file
View File

@@ -0,0 +1,5 @@
# frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "ezdoc"
require "minitest/autorun"