metamagic 3.1.6 → 3.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57930b74a808316cefbeec3bbc64ef77b663fabb
4
- data.tar.gz: c95622c22507fac0b58ce38d7621d552aea66711
3
+ metadata.gz: fef9fb59185f1715f9fda028368eb61be9ce4c75
4
+ data.tar.gz: 23e124fac9b5c74730f2025b677973341930a361
5
5
  SHA512:
6
- metadata.gz: 0dd898c6711a29f723fac3f9863d36d494cb0d91eb79bfc8033d5d8063dc70a62f92e86c29f2a94c4728c4a61f55e7d078bc0a6c40b160b66f64360c9e397288
7
- data.tar.gz: b245b1875056f118f934d9c119a41dc9df80d03c5dbb93d04d4f422868aa9f16706c67d862d236fa9b811374d7abae7e1c8044c267ba6ab2f535dcd86642c6f5
6
+ metadata.gz: 07197a459f8b247476d97a6a42490b54520d0097fab42c11b87d9c585236dbc6356a7fa31d8c9e900621c40b4b6b81e9dc2d69805b0068d811e10fcdaa23495b
7
+ data.tar.gz: 16fe2f263fe097f41884f2e2f508c4657c268760c0b8bf158a6fa3d60e209cc115a3690d9bc70aeee0c989b9940d647fa509a155b69bd2d66abd48d61fd813ef
data/README.md CHANGED
@@ -307,8 +307,8 @@ This will generate the following:
307
307
  ```html
308
308
  <head>
309
309
  ...
310
- <meta content="summary" property="twitter:card" />
311
- <meta content="@flickr" property="twitter:site" />
310
+ <meta content="summary" name="twitter:card" />
311
+ <meta content="@flickr" name="twitter:site" />
312
312
  ...
313
313
  </head>
314
314
  ```
@@ -1,7 +1,7 @@
1
1
  module Metamagic
2
- class TwitterTag < PropertyTag
3
- def remove_prefix?
4
- false
2
+ class TwitterTag < MetaTag
3
+ def sort_order
4
+ 3
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module Metamagic
2
- VERSION = "3.1.6"
2
+ VERSION = "3.1.7"
3
3
  end
@@ -0,0 +1,58 @@
1
+ # USAGE: Hash.from_xml:(YOUR_XML_STRING)
2
+ require 'nokogiri'
3
+ # modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297
4
+
5
+ class Hash
6
+ class << self
7
+ def from_xml(xml_io)
8
+ result = Loofah.fragment("<div>#{xml_io}</div>") # wrap
9
+ xml_node_to_hash(result.children.first)
10
+ end
11
+
12
+ def xml_node_to_hash(node)
13
+ # If we are at the root of the document, start the hash
14
+ if node.element?
15
+ result_hash = {}
16
+ if node.attributes != {}
17
+ result_hash[:attributes] = {}
18
+ node.attributes.keys.each do |key|
19
+ result_hash[:attributes][node.attributes[key].name.to_sym] = prepare(node.attributes[key].value)
20
+ end
21
+ end
22
+ if node.children.size > 0
23
+ node.children.each do |child|
24
+ result = xml_node_to_hash(child)
25
+
26
+ if child.name == "text"
27
+ unless child.next_sibling || child.previous_sibling
28
+ return prepare(result)
29
+ end
30
+ elsif result_hash[child.name.to_sym]
31
+ if result_hash[child.name.to_sym].is_a?(Object::Array)
32
+ result_hash[child.name.to_sym] << prepare(result)
33
+ else
34
+ result_hash[child.name.to_sym] = [result_hash[child.name.to_sym]] << prepare(result)
35
+ end
36
+ else
37
+ result_hash[child.name.to_sym] = prepare(result)
38
+ end
39
+ end
40
+
41
+ return result_hash
42
+ else
43
+ return result_hash
44
+ end
45
+ else
46
+ return prepare(node.content.to_s)
47
+ end
48
+ end
49
+
50
+ def prepare(data)
51
+ (data.class == String && data.to_i.to_s == data) ? data.to_i : data
52
+ end
53
+ end
54
+
55
+ def to_struct(struct_name)
56
+ Struct.new(struct_name,*keys).new(*values)
57
+ end
58
+ end
@@ -0,0 +1,21 @@
1
+ require 'test_helper'
2
+
3
+ class HashFromXmlTest < ActionView::TestCase
4
+
5
+ test "from xml exmpty " do
6
+ xml = ''
7
+ assert_equal Hash.from_xml(xml), {}
8
+ end
9
+
10
+ test "from xml 1 level " do
11
+ xml = '<meta name="description" content="description_text">'
12
+ assert_equal Hash.from_xml(xml), { meta: { attributes: { name: "description", content: "description_text" } } }
13
+ end
14
+
15
+ test "from xml 2 level s" do
16
+ xml = '<div><span id="span1"></span><span id="span2"></span></div>'
17
+ assert_equal Hash.from_xml(xml), { div: { span: [ { attributes: { id: "span1" } },
18
+ { attributes: { id: "span2" } } ] } }
19
+ end
20
+
21
+ end
@@ -9,7 +9,7 @@ class LinkTagTest < ActionView::TestCase
9
9
  }
10
10
  rel publisher: "http://test.com/publisher.html"
11
11
 
12
- assert_equal %{<link href="http://test.com/author.html" rel="author" />\n<link href="http://test.com/publisher.html" rel="publisher" />},
12
+ assert_equal_segment %{<link href="http://test.com/author.html" rel="author" />\n<link href="http://test.com/publisher.html" rel="publisher" />},
13
13
  metamagic
14
14
  end
15
15
  end
@@ -7,7 +7,7 @@ class MetaTagTest < ActionView::TestCase
7
7
  meta keywords: %w{one two three},
8
8
  description: "My description"
9
9
 
10
- assert_equal %{<meta content="one, two, three" name="keywords" />\n<meta content="My description" name="description" />},
10
+ assert_equal_segment %{<meta content="one, two, three" name="keywords" />\n<meta content="My description" name="description" />},
11
11
  metamagic
12
12
  end
13
13
 
@@ -15,7 +15,7 @@ class MetaTagTest < ActionView::TestCase
15
15
  keywords %w{one two three}
16
16
  description "My description"
17
17
 
18
- assert_equal %{<meta content="one, two, three" name="keywords" />\n<meta content="My description" name="description" />},
18
+ assert_equal_segment %{<meta content="one, two, three" name="keywords" />\n<meta content="My description" name="description" />},
19
19
  metamagic
20
20
  end
21
21
 
@@ -23,14 +23,14 @@ class MetaTagTest < ActionView::TestCase
23
23
  title "Test Title"
24
24
  description nil
25
25
 
26
- assert_equal %{<title>Test Title</title>},
26
+ assert_equal_segment %{<title>Test Title</title>},
27
27
  metamagic
28
28
  end
29
29
 
30
30
  test "array as meta value" do
31
31
  keywords %w{one two three}
32
32
 
33
- assert_equal %{<meta content="one, two, three" name="keywords" />},
33
+ assert_equal_segment %{<meta content="one, two, three" name="keywords" />},
34
34
  metamagic
35
35
  end
36
36
 
@@ -38,7 +38,7 @@ class MetaTagTest < ActionView::TestCase
38
38
  title "Test Title"
39
39
  keywords []
40
40
 
41
- assert_equal %{<title>Test Title</title>},
41
+ assert_equal_segment %{<title>Test Title</title>},
42
42
  metamagic
43
43
  end
44
44
 
@@ -46,7 +46,7 @@ class MetaTagTest < ActionView::TestCase
46
46
  title "Test Title"
47
47
  keywords ["one", nil, "two"]
48
48
 
49
- assert_equal %{<title>Test Title</title>\n<meta content="one, two" name="keywords" />},
49
+ assert_equal_segment %{<title>Test Title</title>\n<meta content="one, two" name="keywords" />},
50
50
  metamagic
51
51
  end
52
52
 
@@ -54,40 +54,40 @@ class MetaTagTest < ActionView::TestCase
54
54
  title "Test Title"
55
55
  keywords [nil]
56
56
 
57
- assert_equal %{<title>Test Title</title>},
57
+ assert_equal_segment %{<title>Test Title</title>},
58
58
  metamagic
59
59
  end
60
60
 
61
61
  test "keywords template" do
62
62
  keywords %w{added keywords}
63
63
 
64
- assert_equal %{<meta content="added, keywords, default, from, layout" name="keywords" />},
64
+ assert_equal_segment %{<meta content="added, keywords, default, from, layout" name="keywords" />},
65
65
  metamagic(keywords: [:keywords, "default", "from", "layout"])
66
66
  end
67
67
 
68
68
  test "keywords template with no keywords" do
69
- assert_equal %{<meta content="default, from, layout" name="keywords" />},
69
+ assert_equal_segment %{<meta content="default, from, layout" name="keywords" />},
70
70
  metamagic(keywords: [:keywords, "default", "from", "layout"])
71
71
  end
72
72
 
73
73
  test "unique values using templates" do
74
74
  keywords %w{added keywords}
75
75
 
76
- assert_equal %{<meta content="added, keywords, default, from, layout" name="keywords" />},
76
+ assert_equal_segment %{<meta content="added, keywords, default, from, layout" name="keywords" />},
77
77
  metamagic(keywords: [:keywords, "added", "default", "keywords", "from", "layout"])
78
78
  end
79
79
 
80
80
  test "html safe keywords" do
81
81
  keywords ["one", "two &rarr; test".html_safe, "three"]
82
82
 
83
- assert_equal %{<meta content="one, two &rarr; test, three" name="keywords" />},
83
+ assert_equal_segment %{<meta content="one, two &rarr; test, three" name="keywords" />},
84
84
  metamagic
85
85
  end
86
86
 
87
87
  test "html unsafe keywords" do
88
88
  keywords ["one", "two &rarr; test", "three"]
89
89
 
90
- assert_equal %{<meta content="one, two &amp;rarr; test, three" name="keywords" />},
90
+ assert_equal_segment %{<meta content="one, two &amp;rarr; test, three" name="keywords" />},
91
91
  metamagic
92
92
  end
93
93
  end
@@ -8,7 +8,7 @@ class MetamagicTest < ActionView::TestCase
8
8
  description: "My description.",
9
9
  keywords: ["One", "Two", "Three"]
10
10
 
11
- assert_equal %{<title>My Title</title>\n<meta content="My description." name="description" />\n<meta content="One, Two, Three" name="keywords" />},
11
+ assert_equal_segment %{<title>My Title</title>\n<meta content="My description." name="description" />\n<meta content="One, Two, Three" name="keywords" />},
12
12
  metamagic
13
13
  end
14
14
 
@@ -16,7 +16,7 @@ class MetamagicTest < ActionView::TestCase
16
16
  meta title: "Test Title",
17
17
  test: "Test tag"
18
18
 
19
- assert_equal %{<title>Test Title</title>\n<meta content="Test tag" name="test" />\n<meta content="Default description" name="description" />},
19
+ assert_equal_segment %{<title>Test Title</title>\n<meta content="Test tag" name="test" />\n<meta content="Default description" name="description" />},
20
20
  metamagic(title: "Default Title", description: "Default description", test: "Default test")
21
21
  end
22
22
 
@@ -24,7 +24,7 @@ class MetamagicTest < ActionView::TestCase
24
24
  meta title: "Test Title",
25
25
  test: "Test tag"
26
26
 
27
- assert_equal %{<title>Test Title</title>\n<meta content="Test tag" name="test" />\n<meta content="Default\n:something" name="description" />},
27
+ assert_equal_segment %{<title>Test Title</title>\n<meta content="Test tag" name="test" />\n<meta content="Default\n:something" name="description" />},
28
28
  metamagic(title: "Default:Title", description: "Default\n:something", test: "Default test")
29
29
  end
30
30
 
@@ -35,7 +35,7 @@ class MetamagicTest < ActionView::TestCase
35
35
  meta title: "Second Title",
36
36
  description: "Second description."
37
37
 
38
- assert_equal %{<title>Test Title</title>\n<meta content="Test description." name="description" />},
38
+ assert_equal_segment %{<title>Test Title</title>\n<meta content="Test description." name="description" />},
39
39
  metamagic
40
40
  end
41
41
 
@@ -46,7 +46,7 @@ class MetamagicTest < ActionView::TestCase
46
46
  title "Second Title"
47
47
  description "Second description."
48
48
 
49
- assert_equal %{<title>Test Title</title>\n<meta content="Test description." name="description" />},
49
+ assert_equal_segment %{<title>Test Title</title>\n<meta content="Test description." name="description" />},
50
50
  metamagic
51
51
  end
52
52
 
@@ -55,20 +55,20 @@ class MetamagicTest < ActionView::TestCase
55
55
  description "My description"
56
56
  keywords %w{one two three}
57
57
 
58
- assert_equal %{<title>My Title</title>\n<meta content="My description" name="description" />\n<meta content="one, two, three" name="keywords" />},
58
+ assert_equal_segment %{<title>My Title</title>\n<meta content="My description" name="description" />\n<meta content="one, two, three" name="keywords" />},
59
59
  metamagic
60
60
  end
61
61
 
62
62
  test "shortcut helper returns value" do
63
- assert_equal "My Title", title("My Title")
64
- assert_equal "My Description", description("My Description")
65
- assert_equal %w{one two three}, keywords(%w{one two three})
63
+ assert_equal_segment "My Title", title("My Title")
64
+ assert_equal_segment "My Description", description("My Description")
65
+ assert_equal_segment %w{one two three}, keywords(%w{one two three})
66
66
  end
67
67
 
68
68
  test "not adding templates from views" do
69
69
  title "This is a :nonexistent_key"
70
70
 
71
- assert_equal %{<title>This is a :nonexistent_key</title>},
71
+ assert_equal_segment %{<title>This is a :nonexistent_key</title>},
72
72
  metamagic
73
73
  end
74
74
 
@@ -79,7 +79,7 @@ class MetamagicTest < ActionView::TestCase
79
79
  keywords %w{one two three}
80
80
  title "My Title"
81
81
 
82
- assert_equal %{<title>My Title</title>\n<meta content="one, two, three" name="keywords" />\n<meta content="My description." name="description" />\n<meta content="http://test.com/image.png" property="og:image" />\n<meta content="summary" property="twitter:card" />},
82
+ assert_equal_segment %{<title>My Title</title>\n<meta content="one, two, three" name="keywords" />\n<meta content="My description." name="description" />\n<meta content="http://test.com/image.png" property="og:image" />\n<meta content="summary" name="twitter:card" />},
83
83
  metamagic
84
84
  end
85
85
  end
@@ -12,7 +12,7 @@ class OpenGraphTest < ActionView::TestCase
12
12
  }
13
13
  og image: { type: "image/png" }
14
14
 
15
- assert_equal %{<title>Test Title</title>\n<meta content="http://test.com/image.jpg" property="og:image:url" />\n<meta content="image/png" property="og:image:type" />},
15
+ assert_equal_segment %{<title>Test Title</title>\n<meta content="http://test.com/image.jpg" property="og:image:url" />\n<meta content="image/png" property="og:image:type" />},
16
16
  metamagic
17
17
  end
18
18
  end
@@ -7,14 +7,14 @@ class PropertyTagTest < ActionView::TestCase
7
7
  meta property: { one: "Property One", two: "Property Two", "og:image" => "http://test.com/image.png", nested: { a: "Nested A" } }
8
8
  property two: "Property Two second", three: "Property Three", nested: { a: "Nested A second", b: "Nested B" }
9
9
 
10
- assert_equal %{<meta content="Property One" property="one" />\n<meta content="Property Two" property="two" />\n<meta content="http://test.com/image.png" property="og:image" />\n<meta content="Nested A" property="nested:a" />\n<meta content="Property Three" property="three" />\n<meta content="Nested B" property="nested:b" />},
10
+ assert_equal_segment %{<meta content="Property One" property="one" />\n<meta content="Property Two" property="two" />\n<meta content="http://test.com/image.png" property="og:image" />\n<meta content="Nested A" property="nested:a" />\n<meta content="Property Three" property="three" />\n<meta content="Nested B" property="nested:b" />},
11
11
  metamagic
12
12
  end
13
13
 
14
14
  test "property array" do
15
15
  og image: ["one.jpg", "two.jpg"]
16
16
 
17
- assert_equal %{<meta content="one.jpg" property="og:image" />\n<meta content="two.jpg" property="og:image" />},
17
+ assert_equal_segment %{<meta content="one.jpg" property="og:image" />\n<meta content="two.jpg" property="og:image" />},
18
18
  metamagic
19
19
  end
20
20
 
@@ -22,7 +22,7 @@ class PropertyTagTest < ActionView::TestCase
22
22
  og title: "Test Title",
23
23
  image: nil
24
24
 
25
- assert_equal %{<meta content="Test Title" property="og:title" />},
25
+ assert_equal_segment %{<meta content="Test Title" property="og:title" />},
26
26
  metamagic
27
27
  end
28
28
 
@@ -30,7 +30,7 @@ class PropertyTagTest < ActionView::TestCase
30
30
  og title: "Test Title",
31
31
  image: [nil]
32
32
 
33
- assert_equal %{<meta content="Test Title" property="og:title" />},
33
+ assert_equal_segment %{<meta content="Test Title" property="og:title" />},
34
34
  metamagic
35
35
  end
36
36
 
@@ -38,7 +38,7 @@ class PropertyTagTest < ActionView::TestCase
38
38
  og title: "Test Title",
39
39
  image: ["one.jpg", nil, "two.jpg"]
40
40
 
41
- assert_equal %{<meta content="Test Title" property="og:title" />\n<meta content="one.jpg" property="og:image" />\n<meta content="two.jpg" property="og:image" />},
41
+ assert_equal_segment %{<meta content="Test Title" property="og:title" />\n<meta content="one.jpg" property="og:image" />\n<meta content="two.jpg" property="og:image" />},
42
42
  metamagic
43
43
  end
44
44
 
@@ -49,14 +49,14 @@ class PropertyTagTest < ActionView::TestCase
49
49
  tag: []
50
50
  }
51
51
 
52
- assert_equal %{<meta content="http://test.com/image.png" property="og:image" />\n<meta content="Leif Davidsen" property="og:book:author" />\n<meta content="Anders Mogensen" property="og:book:author" />},
52
+ assert_equal_segment %{<meta content="http://test.com/image.png" property="og:image" />\n<meta content="Leif Davidsen" property="og:book:author" />\n<meta content="Anders Mogensen" property="og:book:author" />},
53
53
  metamagic
54
54
  end
55
55
 
56
56
  test "property template" do
57
57
  og image: "http://test.com/image.jpg"
58
58
 
59
- assert_equal %{<meta content="http://test.com/image.jpg" property="og:image" />\n<meta content="http://test.com/image2.jpg" property="og:image" />},
59
+ assert_equal_segment %{<meta content="http://test.com/image.jpg" property="og:image" />\n<meta content="http://test.com/image2.jpg" property="og:image" />},
60
60
  metamagic(og: { image: [:og_image, "http://test.com/image2.jpg"] })
61
61
  end
62
62
  end
@@ -3,9 +3,16 @@ ENV["RAILS_ENV"] = "test"
3
3
 
4
4
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
5
  require "rails/test_help"
6
+ require 'hash_from_xml'
6
7
 
7
8
  Rails.backtrace_cleaner.remove_silencers!
8
9
 
10
+ class ActionView::TestCase
11
+ def assert_equal_segment(first, second)
12
+ assert_equal Hash.from_xml(first), Hash.from_xml(second)
13
+ end
14
+ end
15
+
9
16
  # Load support files
10
17
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
18
 
@@ -7,14 +7,14 @@ class TitleTagTest < ActionView::TestCase
7
7
  test "title tag" do
8
8
  meta title: "My Title"
9
9
 
10
- assert_equal %{<title>My Title</title>},
10
+ assert_equal_segment %{<title>My Title</title>},
11
11
  metamagic
12
12
  end
13
13
 
14
14
  test "shortcut helper" do
15
15
  title "My Title"
16
16
 
17
- assert_equal %{<title>My Title</title>},
17
+ assert_equal_segment %{<title>My Title</title>},
18
18
  metamagic
19
19
  end
20
20
 
@@ -22,38 +22,38 @@ class TitleTagTest < ActionView::TestCase
22
22
  title nil
23
23
  description "Test description"
24
24
 
25
- assert_equal %{<meta content="Test description" name="description" />},
25
+ assert_equal_segment %{<meta content="Test description" name="description" />},
26
26
  metamagic
27
27
  end
28
28
 
29
29
  test "title template" do
30
30
  title "Test Title"
31
31
 
32
- assert_equal %{<title>Test Title - My Site</title>},
32
+ assert_equal_segment %{<title>Test Title - My Site</title>},
33
33
  metamagic(site: "My Site", title: ":title - :site")
34
34
  end
35
35
 
36
36
  test "title template with no title set" do
37
- assert_equal %{<title> - My Site</title>},
37
+ assert_equal_segment %{<title> - My Site</title>},
38
38
  metamagic(site: "My Site", title: ":title - :site")
39
39
  end
40
40
 
41
41
  test "title separator" do
42
42
  title "Test Title"
43
43
 
44
- assert_equal %{<title>Test Title - My Site</title>},
44
+ assert_equal_segment %{<title>Test Title - My Site</title>},
45
45
  metamagic(site: "My Site", title: [:title, :site])
46
46
  end
47
47
 
48
48
  test "custom title separator" do
49
49
  title "Test Title"
50
50
 
51
- assert_equal %{<title>Test Title | My Site</title>},
51
+ assert_equal_segment %{<title>Test Title | My Site</title>},
52
52
  metamagic(site: "My Site", separator: " | ", title: [:title, :site])
53
53
  end
54
54
 
55
55
  test "title separator with no title" do
56
- assert_equal %{<title>My Site</title>},
56
+ assert_equal_segment %{<title>My Site</title>},
57
57
  metamagic(site: "My Site", title: [:title, :site])
58
58
  end
59
59
 
@@ -68,63 +68,63 @@ class TitleTagTest < ActionView::TestCase
68
68
  test "title template proc" do
69
69
  title "Test Title"
70
70
 
71
- assert_equal %{<title>Site: My Site - Title: Test Title</title>},
71
+ assert_equal_segment %{<title>Site: My Site - Title: Test Title</title>},
72
72
  metamagic(site: "My Site", title: -> { "Site: #{site} - Title: #{title}" })
73
73
  end
74
74
 
75
75
  test "title template from view helper" do
76
76
  title "Test Title"
77
77
 
78
- assert_equal %{<title>From view helper: Test Title - My Site</title>},
78
+ assert_equal_segment %{<title>From view helper: Test Title - My Site</title>},
79
79
  metamagic(site: "My Site", title: -> { meta_title_for(site, title) })
80
80
  end
81
81
 
82
82
  test "html safe titles" do
83
83
  title "My Site &rarr; Test".html_safe
84
84
 
85
- assert_equal %{<title>My Site &rarr; Test</title>},
85
+ assert_equal_segment %{<title>My Site &rarr; Test</title>},
86
86
  metamagic
87
87
  end
88
88
 
89
89
  test "html safe titles in template" do
90
90
  title "Test &rarr; Test".html_safe
91
91
 
92
- assert_equal %{<title>Test &rarr; Test - My Site</title>},
92
+ assert_equal_segment %{<title>Test &rarr; Test - My Site</title>},
93
93
  metamagic(title: ":title - :site", site: "My Site")
94
94
  end
95
95
 
96
96
  test "html unsafe titles" do
97
97
  title "My Site &rarr; Test"
98
98
 
99
- assert_equal %{<title>My Site &amp;rarr; Test</title>},
99
+ assert_equal_segment %{<title>My Site &amp;rarr; Test</title>},
100
100
  metamagic
101
101
  end
102
102
 
103
103
  test "html unsafe titles in template" do
104
104
  title "Test &rarr; Test"
105
105
 
106
- assert_equal %{<title>Test &amp;rarr; Test - My Site</title>},
106
+ assert_equal_segment %{<title>Test &amp;rarr; Test - My Site</title>},
107
107
  metamagic(title: ":title - :site", site: "My Site")
108
108
  end
109
109
 
110
110
  test "html safe title template" do
111
111
  title "Test Title"
112
112
 
113
- assert_equal %{<title>Test Title &rarr; My Site</title>},
113
+ assert_equal_segment %{<title>Test Title &rarr; My Site</title>},
114
114
  metamagic(title: ":title &rarr; :site".html_safe, site: "My Site")
115
115
  end
116
116
 
117
117
  test "html unsafe title template" do
118
118
  title "Test Title"
119
119
 
120
- assert_equal %{<title>Test Title &amp;rarr; My Site</title>},
120
+ assert_equal_segment %{<title>Test Title &amp;rarr; My Site</title>},
121
121
  metamagic(title: ":title &rarr; :site", site: "My Site")
122
122
  end
123
123
 
124
124
  test "deprecated title_template option" do
125
125
  title "Test Title"
126
126
 
127
- assert_equal %{<title>Test Title - My Site</title>},
127
+ assert_equal_segment %{<title>Test Title - My Site</title>},
128
128
  metamagic(site: "My Site", title_template: ":title - :site")
129
129
  end
130
130
  end
@@ -11,7 +11,7 @@ class TwitterTest < ActionView::TestCase
11
11
  twitter site: "@flickr"
12
12
 
13
13
 
14
- assert_equal %{<title>Test Title</title>\n<meta content="summary" property="twitter:card" />\n<meta content="@flickr" property="twitter:site" />},
14
+ assert_equal_segment %{<title>Test Title</title>\n<meta content="summary" name="twitter:card" />\n<meta content="@flickr" name="twitter:site" />},
15
15
  metamagic
16
16
  end
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metamagic
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.6
4
+ version: 3.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lasse Bunk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-10 00:00:00.000000000 Z
11
+ date: 2015-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -105,6 +105,8 @@ files:
105
105
  - test/dummy/public/422.html
106
106
  - test/dummy/public/500.html
107
107
  - test/dummy/public/favicon.ico
108
+ - test/hash_from_xml.rb
109
+ - test/hash_from_xml_test.rb
108
110
  - test/legacy_test.rb
109
111
  - test/link_tag_test.rb
110
112
  - test/meta_tag_test.rb
@@ -179,6 +181,8 @@ test_files:
179
181
  - test/dummy/public/422.html
180
182
  - test/dummy/public/500.html
181
183
  - test/dummy/public/favicon.ico
184
+ - test/hash_from_xml.rb
185
+ - test/hash_from_xml_test.rb
182
186
  - test/legacy_test.rb
183
187
  - test/link_tag_test.rb
184
188
  - test/meta_tag_test.rb