require 'test_helper'
class PropertyTagTest < ActionView::TestCase
include Metamagic::ViewHelper
test "property tags" do
meta property: { one: "Property One", two: "Property Two", "og:image" => "http://test.com/image.png", nested: { a: "Nested A" } }
property two: "Property Two second", three: "Property Three", nested: { a: "Nested A second", b: "Nested B" }
assert_equal %{\n\n\n\n\n},
metamagic
end
test "property array" do
og image: ["one.jpg", "two.jpg"]
assert_equal %{\n},
metamagic
end
test "nil property" do
og title: "Test Title",
image: nil
assert_equal %{},
metamagic
end
test "nil only property array" do
og title: "Test Title",
image: [nil]
assert_equal %{},
metamagic
end
test "nil in property array" do
og title: "Test Title",
image: ["one.jpg", nil, "two.jpg"]
assert_equal %{\n\n},
metamagic
end
test "empty property array" do
og image: "http://test.com/image.png",
book: {
author: ["Leif Davidsen", "Anders Mogensen"],
tag: []
}
assert_equal %{\n\n},
metamagic
end
test "property template" do
og image: "http://test.com/image.jpg"
assert_equal %{\n},
metamagic(og: { image: [:og_image, "http://test.com/image2.jpg"] })
end
end