meta-tags 2.2.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +2 -0
- data/.travis.yml +3 -3
- data/CHANGELOG.md +10 -0
- data/Gemfile +0 -1
- data/MIT-LICENSE +2 -2
- data/README.md +324 -218
- data/Rakefile +0 -20
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/meta_tags/renderer.rb +1 -0
- data/lib/meta_tags/version.rb +1 -1
- data/meta-tags.gemspec +24 -26
- metadata +24 -67
- metadata.gz.sig +2 -4
- data/.ruby-gemset +0 -1
- data/spec/configuration_spec.rb +0 -14
- data/spec/controller_helper_spec.rb +0 -45
- data/spec/spec_helper.rb +0 -84
- data/spec/text_normalizer/normalize_title_spec.rb +0 -48
- data/spec/text_normalizer/truncate_array_spec.rb +0 -60
- data/spec/view_helper/charset_spec.rb +0 -16
- data/spec/view_helper/custom_spec.rb +0 -67
- data/spec/view_helper/description_spec.rb +0 -61
- data/spec/view_helper/icon_spec.rb +0 -42
- data/spec/view_helper/keywords_spec.rb +0 -58
- data/spec/view_helper/links_spec.rb +0 -146
- data/spec/view_helper/module_spec.rb +0 -41
- data/spec/view_helper/noindex_spec.rb +0 -107
- data/spec/view_helper/open_graph_spec.rb +0 -86
- data/spec/view_helper/open_search_spec.rb +0 -33
- data/spec/view_helper/refresh_spec.rb +0 -32
- data/spec/view_helper/title_spec.rb +0 -183
- data/spec/view_helper/twitter_spec.rb +0 -31
- data/spec/view_helper_spec.rb +0 -83
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::TextNormalizer, '.normalize_title' do
|
4
|
-
context 'when site_title is blank' do
|
5
|
-
it 'should return title when site_title is blank' do
|
6
|
-
expect(subject.normalize_title(nil, 'title', '-')).to eq('title')
|
7
|
-
expect(subject.normalize_title('', 'title', '-')).to eq('title')
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'should join title parts with separator' do
|
11
|
-
expect(subject.normalize_title('', %w[title subtitle], '-')).to eq('title-subtitle')
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should reverse title parts when reverse is true' do
|
15
|
-
expect(subject.normalize_title('', %w[title subtitle], '-', true)).to eq('subtitle-title')
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should not truncate title when limit is equal to the title length' do
|
19
|
-
title = 'b' * MetaTags.config.title_limit
|
20
|
-
expect(subject.normalize_title('', title, '-')).to eq(title)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'when site_title is specified' do
|
25
|
-
it 'should join title and site_title with separator' do
|
26
|
-
expect(subject.normalize_title('site', 'title', '-')).to eq('site-title')
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should join title parts and site_title with separator' do
|
30
|
-
expect(subject.normalize_title('site', %w[title subtitle], '-')).to eq('site-title-subtitle')
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should reverse title parts when reverse is true' do
|
34
|
-
expect(subject.normalize_title('site', %w[title subtitle], '-', true)).to eq('subtitle-title-site')
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'should not add title when site title is longer than limit' do
|
38
|
-
site_title = 'a' * (MetaTags.config.title_limit - 2)
|
39
|
-
expect(subject.normalize_title(site_title, 'title', '---')).to eq(site_title[0..-2])
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should truncate title when limit is reached' do
|
43
|
-
site_title = 'a' * 20
|
44
|
-
title = 'b' * (MetaTags.config.title_limit + 10)
|
45
|
-
expect(subject.normalize_title(site_title, title, '-')).to eq("#{site_title}-#{'b' * (MetaTags.config.title_limit - 21)}")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::TextNormalizer, '.truncate_array' do
|
4
|
-
it 'should return array as is when limit is not specified' do
|
5
|
-
arr = %w[a]
|
6
|
-
expect(subject.truncate_array(arr, nil)).to be(arr)
|
7
|
-
expect(subject.truncate_array(arr, 0)).to be(arr)
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'should return a new array when limit is specified' do
|
11
|
-
arr = %w[a]
|
12
|
-
expect(subject.truncate_array(arr, 1)).to_not be(arr)
|
13
|
-
end
|
14
|
-
|
15
|
-
context 'when separator is empty string' do
|
16
|
-
it 'should return the whole array when total size is less than or equal to limit' do
|
17
|
-
arr = %w[a a]
|
18
|
-
expect(subject.truncate_array(arr, 5)).to eq(arr)
|
19
|
-
expect(subject.truncate_array(arr, 2)).to eq(arr)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should truncate array to specified limit' do
|
23
|
-
arr = %w[a a a a a]
|
24
|
-
expect(subject.truncate_array(arr, 3)).to eq(%w[a a a])
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should truncate last word to match the limit' do
|
28
|
-
arr = %w[a a aaaa aa]
|
29
|
-
expect(subject.truncate_array(arr, 4)).to eq(%w[a a aa])
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should use natural separator when truncating a long word' do
|
33
|
-
arr = ['a', 'aa aaaa', 'aa']
|
34
|
-
expect(subject.truncate_array(arr, 7)).to eq(%w[a aa])
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'when separator is specified' do
|
39
|
-
it 'should return the whole array when total size is less than or equal to limit' do
|
40
|
-
arr = %w[a a]
|
41
|
-
expect(subject.truncate_array(arr, 5, '-')).to eq(arr)
|
42
|
-
expect(subject.truncate_array(arr, 3, '-')).to eq(arr)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'should truncate array to specified limit' do
|
46
|
-
arr = %w[a a a a a]
|
47
|
-
expect(subject.truncate_array(arr, 3, '-')).to eq(%w[a a])
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should truncate last word to match the limit' do
|
51
|
-
arr = %w[a a aaaa aa]
|
52
|
-
expect(subject.truncate_array(arr, 5, '-')).to eq(%w[a a a])
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should use natural separator when truncating a long word' do
|
56
|
-
arr = ['a', 'aa aaaa', 'aa']
|
57
|
-
expect(subject.truncate_array(arr, 7, '-')).to eq(%w[a aa])
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper, 'displaying charset' do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
it 'should not display charset if blank' do
|
7
|
-
expect(subject.display_meta_tags).to eq('')
|
8
|
-
expect(subject.display_meta_tags(charset: '')).to eq('')
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should display charset' do
|
12
|
-
subject.display_meta_tags(charset: 'UTF-8').tap do |meta|
|
13
|
-
expect(meta).to eq('<meta charset="UTF-8" />')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
context 'display any named meta tag that you want to' do
|
7
|
-
it 'should display testing meta tag' do
|
8
|
-
subject.display_meta_tags(testing: 'this is a test').tap do |meta|
|
9
|
-
expect(meta).to have_tag('meta', with: { content: "this is a test", name: "testing" })
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should support Array values' do
|
14
|
-
subject.display_meta_tags(testing: ['test1', 'test2']).tap do |meta|
|
15
|
-
expect(meta).to have_tag('meta', with: { content: "test1", name: "testing" })
|
16
|
-
expect(meta).to have_tag('meta', with: { content: "test2", name: "testing" })
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should support Hash values' do
|
21
|
-
subject.display_meta_tags(testing: { tag: 'value' }).tap do |meta|
|
22
|
-
expect(meta).to have_tag('meta', with: { content: "value", name: "testing:tag" })
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should support symbolic references in Hash values' do
|
27
|
-
subject.display_meta_tags(title: 'my title', testing: { tag: :title }).tap do |meta|
|
28
|
-
expect(meta).to have_tag('meta', with: { content: "my title", name: "testing:tag" })
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should not render when value is nil' do
|
33
|
-
subject.display_meta_tags(testing: nil).tap do |meta|
|
34
|
-
expect(meta).to eq('')
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should display meta tags with hashes and arrays' do
|
39
|
-
subject.set_meta_tags(foo: {
|
40
|
-
bar: "lorem",
|
41
|
-
baz: {
|
42
|
-
qux: ["lorem", "ipsum"]
|
43
|
-
},
|
44
|
-
quux: [
|
45
|
-
{
|
46
|
-
corge: "lorem",
|
47
|
-
grault: "ipsum"
|
48
|
-
},
|
49
|
-
{
|
50
|
-
corge: "dolor",
|
51
|
-
grault: "sit"
|
52
|
-
}
|
53
|
-
]
|
54
|
-
})
|
55
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
56
|
-
expect(meta).to have_tag('meta', with: { content: "lorem", name: "foo:bar" })
|
57
|
-
expect(meta).to have_tag('meta', with: { content: "lorem", name: "foo:baz:qux" })
|
58
|
-
expect(meta).to have_tag('meta', with: { content: "ipsum", name: "foo:baz:qux" })
|
59
|
-
expect(meta).to have_tag('meta', with: { content: "lorem", name: "foo:quux:corge" })
|
60
|
-
expect(meta).to have_tag('meta', with: { content: "ipsum", name: "foo:quux:grault" })
|
61
|
-
expect(meta).to have_tag('meta', with: { content: "dolor", name: "foo:quux:corge" })
|
62
|
-
expect(meta).to have_tag('meta', with: { content: "sit", name: "foo:quux:grault" })
|
63
|
-
expect(meta).to_not have_tag('meta', with: { name: "foo:quux" })
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper, 'displaying description' do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
it 'should not display description if blank' do
|
7
|
-
subject.description('')
|
8
|
-
expect(subject.display_meta_tags).to eq('')
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should display description when "description" used' do
|
12
|
-
subject.description('someDescription')
|
13
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
14
|
-
expect(meta).to have_tag('meta', with: { content: "someDescription", name: "description" })
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should display description when "set_meta_tags" used' do
|
19
|
-
subject.set_meta_tags(description: 'someDescription')
|
20
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
21
|
-
expect(meta).to have_tag('meta', with: { content: "someDescription", name: "description" })
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should display default description' do
|
26
|
-
subject.display_meta_tags(site: 'someSite', description: 'someDescription').tap do |meta|
|
27
|
-
expect(meta).to have_tag('meta', with: { content: "someDescription", name: "description" })
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should use custom description if given' do
|
32
|
-
subject.description('someDescription')
|
33
|
-
subject.display_meta_tags(site: 'someSite', description: 'defaultDescription').tap do |meta|
|
34
|
-
expect(meta).to have_tag('meta', with: { content: "someDescription", name: "description" })
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should strip multiple spaces' do
|
39
|
-
subject.display_meta_tags(site: 'someSite', description: "some \n\r\t description").tap do |meta|
|
40
|
-
expect(meta).to have_tag('meta', with: { content: "some description", name: "description" })
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should strip HTML' do
|
45
|
-
subject.display_meta_tags(site: 'someSite', description: "<p>some <b>description</b></p>").tap do |meta|
|
46
|
-
expect(meta).to have_tag('meta', with: { content: "some description", name: "description" })
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'should change escape double quotes' do
|
51
|
-
subject.display_meta_tags(site: 'someSite', description: 'some "description"').tap do |meta|
|
52
|
-
expect(meta).to have_tag('meta', with: { content: "some \"description\"", name: "description" })
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'should truncate correctly' do
|
57
|
-
subject.display_meta_tags(site: 'someSite', description: "Lorem ipsum dolor sit amet, consectetuer sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.").tap do |meta|
|
58
|
-
expect(meta).to have_tag('meta', with: { content: "Lorem ipsum dolor sit amet, consectetuer sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At", name: "description" })
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
it 'should not display icon by default' do
|
7
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
8
|
-
expect(meta).to_not have_tag('link', with: { rel: 'icon' })
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should display icon when "set_meta_tags" used' do
|
13
|
-
subject.set_meta_tags(icon: '/favicon.ico')
|
14
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
15
|
-
expect(meta).to have_tag('link', with: { href: '/favicon.ico', rel: 'icon', type: 'image/x-icon' })
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should display default canonical url' do
|
20
|
-
subject.display_meta_tags(site: 'someSite', icon: '/favicon.ico').tap do |meta|
|
21
|
-
expect(meta).to have_tag('link', with: { href: '/favicon.ico', rel: 'icon', type: 'image/x-icon' })
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should allow to specify hash as an icon' do
|
26
|
-
subject.set_meta_tags(icon: { href: '/favicon.png', type: 'image/png' })
|
27
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
28
|
-
expect(meta).to have_tag('link', with: { href: '/favicon.png', rel: 'icon', type: 'image/png' })
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should allow to specify multiple icons' do
|
33
|
-
subject.set_meta_tags(icon: [
|
34
|
-
{ href: '/images/icons/icon_96.png', sizes: '32x32 96x96', type: 'image/png' },
|
35
|
-
{ href: '/images/icons/icon_itouch_precomp_32.png', rel: 'apple-touch-icon-precomposed', sizes: '32x32', type: 'image/png' },
|
36
|
-
])
|
37
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
38
|
-
expect(meta).to have_tag('link', with: { href: '/images/icons/icon_96.png', rel: 'icon', type: 'image/png', sizes: '32x32 96x96' })
|
39
|
-
expect(meta).to have_tag('link', with: { href: '/images/icons/icon_itouch_precomp_32.png', rel: 'apple-touch-icon-precomposed', type: 'image/png', sizes: '32x32' })
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper, 'displaying keywords' do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
it 'should not display keywords if blank' do
|
7
|
-
subject.keywords('')
|
8
|
-
expect(subject.display_meta_tags).to eq('')
|
9
|
-
|
10
|
-
subject.keywords([])
|
11
|
-
expect(subject.display_meta_tags).to eq('')
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should display keywords when "keywords" used' do
|
15
|
-
subject.keywords('some-keywords')
|
16
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
17
|
-
expect(meta).to have_tag('meta', with: { content: "some-keywords", name: "keywords" })
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should display keywords when "set_meta_tags" used' do
|
22
|
-
subject.set_meta_tags(keywords: 'some-keywords')
|
23
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
24
|
-
expect(meta).to have_tag('meta', with: { content: "some-keywords", name: "keywords" })
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should display default keywords' do
|
29
|
-
subject.display_meta_tags(site: 'someSite', keywords: 'some-keywords').tap do |meta|
|
30
|
-
expect(meta).to have_tag('meta', with: { content: "some-keywords", name: "keywords" })
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should use custom keywords if given' do
|
35
|
-
subject.keywords('some-keywords')
|
36
|
-
subject.display_meta_tags(site: 'someSite', keywords: 'default_keywords').tap do |meta|
|
37
|
-
expect(meta).to have_tag('meta', with: { content: "some-keywords", name: "keywords" })
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'should lowercase keywords' do
|
42
|
-
subject.display_meta_tags(site: 'someSite', keywords: 'someKeywords').tap do |meta|
|
43
|
-
expect(meta).to have_tag('meta', with: { content: "somekeywords", name: "keywords" })
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should join keywords from Array' do
|
48
|
-
subject.display_meta_tags(site: 'someSite', keywords: %w(keyword1 keyword2)).tap do |meta|
|
49
|
-
expect(meta).to have_tag('meta', with: { content: "keyword1, keyword2", name: "keywords" })
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should join keywords from nested Arrays' do
|
54
|
-
subject.display_meta_tags(site: 'someSite', keywords: [%w(keyword1 keyword2), 'keyword3']).tap do |meta|
|
55
|
-
expect(meta).to have_tag('meta', with: { content: "keyword1, keyword2, keyword3", name: "keywords" })
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,146 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
context 'displaying canonical url' do
|
7
|
-
it 'should not display canonical url by default' do
|
8
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
9
|
-
expect(meta).to_not have_tag('link', with: { href: "http://example.com/base/url", rel: "canonical" })
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should display canonical url when "set_meta_tags" used' do
|
14
|
-
subject.set_meta_tags(canonical: 'http://example.com/base/url')
|
15
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
16
|
-
expect(meta).to have_tag('link', with: { href: "http://example.com/base/url", rel: "canonical" })
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should display default canonical url' do
|
21
|
-
subject.display_meta_tags(site: 'someSite', canonical: 'http://example.com/base/url').tap do |meta|
|
22
|
-
expect(meta).to have_tag('link', with: { href: "http://example.com/base/url", rel: "canonical" })
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'displaying alternate url' do
|
28
|
-
it 'should not display alternate url by default' do
|
29
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
30
|
-
expect(meta).to_not have_tag('link', with: { href: "http://example.fr/base/url", hreflang: "fr", rel: "alternate" })
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should display alternate url when "set_meta_tags" used' do
|
35
|
-
subject.set_meta_tags(alternate: { 'fr' => 'http://example.fr/base/url' })
|
36
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
37
|
-
expect(meta).to have_tag('link', with: { href: "http://example.fr/base/url", hreflang: "fr", rel: "alternate" })
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'should display default alternate url' do
|
42
|
-
subject.display_meta_tags(site: 'someSite', alternate: { 'fr' => 'http://example.fr/base/url' }).tap do |meta|
|
43
|
-
expect(meta).to have_tag('link', with: { href: "http://example.fr/base/url", hreflang: "fr", rel: "alternate" })
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should not display alternate without content" do
|
48
|
-
subject.display_meta_tags(site: 'someSite', alternate: {'zh-Hant' => ''}).tap do |meta|
|
49
|
-
expect(meta).to_not have_tag('link', with: { href: "", hreflang: "zh-Hant", rel: "alternate" })
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should allow to specify an array of alternate links' do
|
54
|
-
subject.display_meta_tags(site: 'someSite', alternate: [
|
55
|
-
{ href: 'http://example.fr/base/url', hreflang: 'fr' },
|
56
|
-
{ href: 'http://example.com/feed.rss', type: 'application/rss+xml', title: 'RSS' },
|
57
|
-
{ href: 'http://m.example.com/page-1', media: 'only screen and (max-width: 640px)'},
|
58
|
-
]).tap do |meta|
|
59
|
-
expect(meta).to have_tag('link', with: { href: "http://example.fr/base/url", hreflang: "fr", rel: "alternate" })
|
60
|
-
expect(meta).to have_tag('link', with: { href: "http://example.com/feed.rss", type: "application/rss+xml", title: 'RSS', rel: "alternate" })
|
61
|
-
expect(meta).to have_tag('link', with: { href: "http://m.example.com/page-1", media: 'only screen and (max-width: 640px)', rel: "alternate" })
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
context 'displaying author link' do
|
67
|
-
it 'should display author link when "set_meta_tags" used' do
|
68
|
-
subject.set_meta_tags(author: 'http://plus.google.com/profile/url')
|
69
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
70
|
-
expect(meta).to have_tag('link', with: { href: "http://plus.google.com/profile/url", rel: "author" })
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
context 'displaying publisher link' do
|
76
|
-
it 'should display publisher link when "set_meta_tags" used' do
|
77
|
-
subject.set_meta_tags(publisher: 'http://plus.google.com/myprofile_url')
|
78
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
79
|
-
expect(meta).to have_tag('link', with: { href: "http://plus.google.com/myprofile_url", rel: "publisher" })
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
context 'displaying prev url' do
|
85
|
-
it 'should not display prev url by default' do
|
86
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
87
|
-
expect(meta).to_not have_tag('link', with: { href: "http://example.com/base/url", rel: "prev" })
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'should display prev url when "set_meta_tags" used' do
|
92
|
-
subject.set_meta_tags(prev: 'http://example.com/base/url')
|
93
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
94
|
-
expect(meta).to have_tag('link', with: { href: "http://example.com/base/url", rel: "prev" })
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'should display default prev url' do
|
99
|
-
subject.display_meta_tags(site: 'someSite', prev: 'http://example.com/base/url').tap do |meta|
|
100
|
-
expect(meta).to have_tag('link', with: { href: "http://example.com/base/url", rel: "prev" })
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context 'displaying next url' do
|
106
|
-
it 'should not display next url by default' do
|
107
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
108
|
-
expect(meta).to_not have_tag('link', with: { href: "http://example.com/base/url", rel: "next" })
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'should display next url when "set_meta_tags" used' do
|
113
|
-
subject.set_meta_tags(next: 'http://example.com/base/url')
|
114
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
115
|
-
expect(meta).to have_tag('link', with: { href: "http://example.com/base/url", rel: "next" })
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
it 'should display default next url' do
|
120
|
-
subject.display_meta_tags(site: 'someSite', next: 'http://example.com/base/url').tap do |meta|
|
121
|
-
expect(meta).to have_tag('link', with: { href: "http://example.com/base/url", rel: "next" })
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
context 'displaying image_src url' do
|
127
|
-
it 'should not display image_src url by default' do
|
128
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
129
|
-
expect(meta).to_not have_tag('link', with: { href: "http://example.com/base/url", rel: "image_src" })
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'should display image_src url when "set_meta_tags" used' do
|
134
|
-
subject.set_meta_tags(image_src: 'http://example.com/base/url')
|
135
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
136
|
-
expect(meta).to have_tag('link', with: { href: "http://example.com/base/url", rel: "image_src" })
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'should display default image_src url' do
|
141
|
-
subject.display_meta_tags(site: 'someSite', image_src: 'http://example.com/base/url').tap do |meta|
|
142
|
-
expect(meta).to have_tag('link', with: { href: "http://example.com/base/url", rel: "image_src" })
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|