Sha256: 9dd090b263a136df7bbd2d912276534cfa1965e3babfbb7d58dc36a00cb454ce

Contents?: true

Size: 967 Bytes

Versions: 1

Compression:

Stored size: 967 Bytes

Contents

require 'test_helper'

class MetaTagTest < ActionView::TestCase
  include Metamagic::ViewHelper

  test "nil meta value" do
    title "Test Title"
    description nil

    assert_equal %{<title>Test Title</title>},
                 metamagic
  end

  test "array as meta value" do
    keywords %w{one two three}

    assert_equal %{<meta content="one, two, three" name="keywords" />},
                 metamagic
  end

  test "empty array as meta value" do
    title "Test Title"
    keywords []

    assert_equal %{<title>Test Title</title>},
                 metamagic
  end

  test "nil in array as meta value" do
    title "Test Title"
    keywords ["one", nil, "two"]

    assert_equal %{<title>Test Title</title>\n<meta content="one, two" name="keywords" />},
                 metamagic
  end

  test "nil only array as meta value" do
    title "Test Title"
    keywords [nil]

    assert_equal %{<title>Test Title</title>},
                 metamagic
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metamagic-3.0.1 test/meta_tag_test.rb