# require "rspec/autorun"
RSpec.configure do |config|
config.expect_with :test_unit
end
require "html_format"
describe do
before do
HtmlFormat.default_options[:table_class] = ["foo"]
end
it "html_format" do
assert_nil html_format(nil)
assert_equal "
", html_format(1)
end
it "to_html" do
assert_equal "", 1.to_html
assert_nil [].to_html
assert_nil "".to_html
end
it "array of hash" do
v = [
{id: 1, name: "alice", created_at: "2000-01-01"},
{id: 2, name: "bob", created_at: "2000-01-02"},
{id: 3, name: "carol", created_at: "2000-01-03"},
]
assert_equal "", v.to_html
end
it "hash"do
v = {id: 1, name: "alice", created_at: "2000-01-01"}
assert_equal "", v.to_html
end
it "array of array" do
v = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
]
assert_equal "", v.to_html
end
it "array" do
assert_equal "", [0, 1, 2, 3].to_html
end
it "title option" do
assert_equal "", [0].to_html(title: "(title)")
end
end