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,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper, 'module' do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
it 'should be mixed into ActionView::Base' do
|
7
|
-
expect(ActionView::Base.included_modules).to include(MetaTags::ViewHelper)
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'should respond to "title" helper' do
|
11
|
-
expect(subject).to respond_to(:title)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should respond to "description" helper' do
|
15
|
-
expect(subject).to respond_to(:description)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'should respond to "keywords" helper' do
|
19
|
-
expect(subject).to respond_to(:keywords)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should respond to "noindex" helper' do
|
23
|
-
expect(subject).to respond_to(:noindex)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should respond to "nofollow" helper' do
|
27
|
-
expect(subject).to respond_to(:nofollow)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should respond to "set_meta_tags" helper' do
|
31
|
-
expect(subject).to respond_to(:set_meta_tags)
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should respond to "display_meta_tags" helper' do
|
35
|
-
expect(subject).to respond_to(:display_meta_tags)
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should respond to "display_title" helper' do
|
39
|
-
expect(subject).to respond_to(:display_title)
|
40
|
-
end
|
41
|
-
end
|
@@ -1,107 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
context 'displaying noindex' do
|
7
|
-
it 'should display noindex when "noindex" used' do
|
8
|
-
subject.noindex(true)
|
9
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
10
|
-
expect(meta).to have_tag('meta', with: { content: "noindex", name: "robots" })
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should display noindex when "set_meta_tags" used' do
|
15
|
-
subject.set_meta_tags(noindex: true)
|
16
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
17
|
-
expect(meta).to have_tag('meta', with: { content: "noindex", name: "robots" })
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should use custom noindex if given' do
|
22
|
-
subject.noindex('some-noindex')
|
23
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
24
|
-
expect(meta).to have_tag('meta', with: { content: "noindex", name: "some-noindex" })
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should display nothing by default' do
|
29
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
30
|
-
expect(meta).to_not have_tag('meta', with: { content: "noindex" })
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should display nothing if given false" do
|
35
|
-
subject.set_meta_tags(noindex: false)
|
36
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
37
|
-
expect(meta).to_not have_tag('meta', with: { content: "robots" })
|
38
|
-
end
|
39
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
40
|
-
expect(meta).to_not have_tag('meta', with: { content: "noindex" })
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'displaying nofollow' do
|
46
|
-
it 'should display nofollow when "nofollow" used' do
|
47
|
-
subject.nofollow(true)
|
48
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
49
|
-
expect(meta).to have_tag('meta', with: { content: "nofollow", name: "robots" })
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should display nofollow when "set_meta_tags" used' do
|
54
|
-
subject.set_meta_tags(nofollow: true)
|
55
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
56
|
-
expect(meta).to have_tag('meta', with: { content: "nofollow", name: "robots" })
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'should use custom nofollow if given' do
|
61
|
-
subject.nofollow('some-nofollow')
|
62
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
63
|
-
expect(meta).to have_tag('meta', with: { content: "nofollow", name: "some-nofollow" })
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'should display nothing by default' do
|
68
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
69
|
-
expect(meta).to_not have_tag('meta', with: { content: "nofollow" })
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
context 'displaying both nofollow and noindex' do
|
75
|
-
it 'should be displayed when set using helpers' do
|
76
|
-
subject.noindex(true)
|
77
|
-
subject.nofollow(true)
|
78
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
79
|
-
expect(meta).to have_tag('meta', with: { content: "noindex, nofollow", name: "robots" })
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'should be displayed when "set_meta_tags" used' do
|
84
|
-
subject.set_meta_tags(nofollow: true, noindex: true)
|
85
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
86
|
-
expect(meta).to have_tag('meta', with: { content: "noindex, nofollow", name: "robots" })
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'should use custom name if string is used' do
|
91
|
-
subject.noindex('some-name')
|
92
|
-
subject.nofollow('some-name')
|
93
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
94
|
-
expect(meta).to have_tag('meta', with: { content: "noindex, nofollow", name: "some-name" })
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'should display two meta tags when different names used' do
|
99
|
-
subject.noindex('some-noindex')
|
100
|
-
subject.nofollow('some-nofollow')
|
101
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
102
|
-
expect(meta).to have_tag('meta', with: { content: "noindex", name: "some-noindex" })
|
103
|
-
expect(meta).to have_tag('meta', with: { content: "nofollow", name: "some-nofollow" })
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper, 'displaying Open Graph meta tags' do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
it 'should display meta tags specified with :open_graph' do
|
7
|
-
subject.set_meta_tags(open_graph: {
|
8
|
-
title: 'Facebook Share Title',
|
9
|
-
description: 'Facebook Share Description'
|
10
|
-
})
|
11
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
12
|
-
expect(meta).to have_tag('meta', with: { content: "Facebook Share Title", property: "og:title" })
|
13
|
-
expect(meta).to have_tag('meta', with: { content: "Facebook Share Description", property: "og:description" })
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should display meta tags specified with :og' do
|
18
|
-
subject.set_meta_tags(og: {
|
19
|
-
title: 'Facebook Share Title',
|
20
|
-
description: 'Facebook Share Description'
|
21
|
-
})
|
22
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
23
|
-
expect(meta).to have_tag('meta', with: { content: "Facebook Share Title", property: "og:title" })
|
24
|
-
expect(meta).to have_tag('meta', with: { content: "Facebook Share Description", property: "og:description" })
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should use deep merge when displaying open graph meta tags' do
|
29
|
-
subject.set_meta_tags(og: { title: 'Facebook Share Title' })
|
30
|
-
subject.display_meta_tags(og: { description: 'Facebook Share Description' }).tap do |meta|
|
31
|
-
expect(meta).to have_tag('meta', with: { content: "Facebook Share Title", property: "og:title" })
|
32
|
-
expect(meta).to have_tag('meta', with: { content: "Facebook Share Description", property: "og:description" })
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should not display meta tags without content" do
|
37
|
-
subject.set_meta_tags(open_graph: {
|
38
|
-
title: '',
|
39
|
-
description: ''
|
40
|
-
})
|
41
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
42
|
-
expect(meta).to_not have_tag('meta', with: { content: "", property: "og:title" })
|
43
|
-
expect(meta).to_not have_tag('meta', with: { content: "", property: "og:description" })
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should display locale meta tags" do
|
48
|
-
subject.display_meta_tags(open_graph: { locale: { _: 'en_GB', alternate: ['fr_FR', 'es_ES'] } }).tap do |meta|
|
49
|
-
expect(meta).to have_tag('meta', with: { content: "en_GB", property: "og:locale" })
|
50
|
-
expect(meta).to have_tag('meta', with: { content: "fr_FR", property: "og:locale:alternate" })
|
51
|
-
expect(meta).to have_tag('meta', with: { content: "es_ES", property: "og:locale:alternate" })
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should display mirrored content" do
|
56
|
-
subject.set_meta_tags(title: 'someTitle')
|
57
|
-
subject.display_meta_tags(open_graph: { title: :title }).tap do |meta|
|
58
|
-
expect(meta).to have_tag('meta', with: { content: "someTitle", property: "og:title" })
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should display open graph meta tags with an array of images" do
|
63
|
-
subject.set_meta_tags(open_graph: {
|
64
|
-
title: 'someTitle',
|
65
|
-
image: [{
|
66
|
-
_: 'http://example.com/1.png',
|
67
|
-
width: 75,
|
68
|
-
height: 75,
|
69
|
-
},
|
70
|
-
{
|
71
|
-
_: 'http://example.com/2.png',
|
72
|
-
width: 50,
|
73
|
-
height: 50,
|
74
|
-
}]
|
75
|
-
})
|
76
|
-
subject.display_meta_tags(site: 'someTitle').tap do |meta|
|
77
|
-
expect(meta).to have_tag('meta', with: { content: "someTitle", property: "og:title" })
|
78
|
-
expect(meta).to have_tag('meta', with: { content: "http://example.com/1.png", property: "og:image" })
|
79
|
-
expect(meta).to have_tag('meta', with: { content: "75", property: "og:image:width" })
|
80
|
-
expect(meta).to have_tag('meta', with: { content: "75", property: "og:image:height" })
|
81
|
-
expect(meta).to have_tag('meta', with: { content: "http://example.com/2.png", property: "og:image" })
|
82
|
-
expect(meta).to have_tag('meta', with: { content: "50", property: "og:image:width" })
|
83
|
-
expect(meta).to have_tag('meta', with: { content: "50", property: "og:image:height" })
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper, 'displaying Open Search meta tags' do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
it 'should display meta tags specified with :open_search' do
|
7
|
-
subject.set_meta_tags(open_search: {
|
8
|
-
title: 'Open Search Title',
|
9
|
-
href: '/open_search_path.xml'
|
10
|
-
})
|
11
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
12
|
-
expect(meta).to have_tag('link', with: {
|
13
|
-
href: '/open_search_path.xml',
|
14
|
-
rel: 'search',
|
15
|
-
title: 'Open Search Title',
|
16
|
-
type: 'application/opensearchdescription+xml',
|
17
|
-
})
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should not display meta tags without content' do
|
22
|
-
subject.set_meta_tags(open_search: {
|
23
|
-
title: '',
|
24
|
-
href: '',
|
25
|
-
})
|
26
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
27
|
-
expect(meta).to_not have_tag('link', with: {
|
28
|
-
rel: 'search',
|
29
|
-
type: 'application/opensearchdescription+xml',
|
30
|
-
})
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper, 'displaying refresh' do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
it 'displays refresh when "refresh" is used' do
|
7
|
-
subject.refresh(5)
|
8
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
9
|
-
expect(meta).to have_tag('meta', with: { content: '5', 'http-equiv' => 'refresh' })
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'displays refresh when "set_meta_tags" used' do
|
14
|
-
subject.set_meta_tags(refresh: 5)
|
15
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
16
|
-
expect(meta).to have_tag('meta', with: { content: '5', 'http-equiv' => 'refresh' })
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should use custom refresh if given' do
|
21
|
-
subject.refresh("5;url=http://example.com/")
|
22
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
23
|
-
expect(meta).to have_tag('meta', with: { content: '5;url=http://example.com/', 'http-equiv' => "refresh" })
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should display nothing by default' do
|
28
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
29
|
-
expect(meta).to_not have_tag('meta', with: { 'http-equiv' => "refresh" })
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,183 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
context 'displaying title' do
|
7
|
-
it 'should not display title if blank' do
|
8
|
-
expect(subject.display_meta_tags).to eq('')
|
9
|
-
subject.title('')
|
10
|
-
expect(subject.display_meta_tags).to eq('')
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should use website name if title is empty' do
|
14
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
15
|
-
expect(meta).to eq('<title>someSite</title>')
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should display title when "title" used' do
|
20
|
-
subject.title('someTitle')
|
21
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
22
|
-
expect(meta).to eq('<title>someSite | someTitle</title>')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should display title only when "site" is empty' do
|
27
|
-
subject.title('someTitle')
|
28
|
-
expect(subject.display_meta_tags).to eq('<title>someTitle</title>')
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should display title when "set_meta_tags" is used' do
|
32
|
-
subject.set_meta_tags(title: 'someTitle')
|
33
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
34
|
-
expect(meta).to eq('<title>someSite | someTitle</title>')
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should escape the title when "set_meta_tags" is used' do
|
39
|
-
subject.set_meta_tags(title: 'someTitle & somethingElse')
|
40
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
41
|
-
expect(meta).to eq('<title>someSite | someTitle & somethingElse</title>')
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'should escape a very long title when "set_meta_tags" is used' do
|
46
|
-
subject.set_meta_tags(title: 'Kombucha kale chips forage try-hard & green juice. IPhone marfa PBR&B venmo listicle, irony kitsch thundercats.')
|
47
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
48
|
-
expect(meta).to eq('<title>someSite | Kombucha kale chips forage try-hard & green juice.</title>')
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'should strip tags in the title' do
|
53
|
-
subject.set_meta_tags(title: '<b>hackxor</b>')
|
54
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
55
|
-
expect(meta).to eq('<title>someSite | hackxor</title>')
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'should strip tags from very long titles' do
|
60
|
-
subject.set_meta_tags(title: 'Kombucha <b>kale</b> chips forage try-hard & green juice. IPhone marfa PBR&B venmo listicle, irony kitsch thundercats.')
|
61
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
62
|
-
expect(meta).to eq('<title>someSite | Kombucha kale chips forage try-hard & green juice.</title>')
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'should display custom title if given' do
|
67
|
-
subject.title('someTitle')
|
68
|
-
subject.display_meta_tags(site: 'someSite', title: 'defaultTitle').tap do |meta|
|
69
|
-
expect(meta).to eq('<title>someSite | someTitle</title>')
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'should use website before page by default' do
|
74
|
-
subject.display_meta_tags(site: 'someSite', title: 'someTitle').tap do |meta|
|
75
|
-
expect(meta).to eq('<title>someSite | someTitle</title>')
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'should only use markup in titles in the view' do
|
80
|
-
expect(subject.title('<b>someTitle</b>')).to eq('<b>someTitle</b>')
|
81
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
82
|
-
expect(meta).to eq('<title>someSite | someTitle</title>')
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'should use page before website if :reverse' do
|
87
|
-
subject.display_meta_tags(site: 'someSite', title: 'someTitle', reverse: true).tap do |meta|
|
88
|
-
expect(meta).to eq('<title>someTitle | someSite</title>')
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'should be lowercase if :lowercase' do
|
93
|
-
subject.display_meta_tags(site: 'someSite', title: 'someTitle', lowercase: true).tap do |meta|
|
94
|
-
expect(meta).to eq('<title>someSite | sometitle</title>')
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'should use custom separator if :separator' do
|
99
|
-
subject.title('someTitle')
|
100
|
-
subject.display_meta_tags(site: 'someSite', separator: '-').tap do |meta|
|
101
|
-
expect(meta).to eq('<title>someSite - someTitle</title>')
|
102
|
-
end
|
103
|
-
subject.display_meta_tags(site: 'someSite', separator: ':').tap do |meta|
|
104
|
-
expect(meta).to eq('<title>someSite : someTitle</title>')
|
105
|
-
end
|
106
|
-
subject.display_meta_tags(site: 'someSite', separator: '&').tap do |meta|
|
107
|
-
expect(meta).to eq('<title>someSite &amp; someTitle</title>')
|
108
|
-
end
|
109
|
-
subject.display_meta_tags(site: 'someSite', separator: '&'.html_safe).tap do |meta|
|
110
|
-
expect(meta).to eq('<title>someSite & someTitle</title>')
|
111
|
-
end
|
112
|
-
subject.display_meta_tags(site: 'someSite: ', separator: false).tap do |meta|
|
113
|
-
expect(meta).to eq('<title>someSite: someTitle</title>')
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
it 'should use custom prefix and suffix if available' do
|
118
|
-
subject.display_meta_tags(site: 'someSite', title: 'someTitle', prefix: ' -', suffix: '- ').tap do |meta|
|
119
|
-
expect(meta).to eq('<title>someSite -|- someTitle</title>')
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'should collapse prefix if false' do
|
124
|
-
subject.display_meta_tags(site: 'someSite', title: 'someTitle', prefix: false).tap do |meta|
|
125
|
-
expect(meta).to eq('<title>someSite| someTitle</title>')
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'should collapse suffix if false' do
|
130
|
-
subject.display_meta_tags(site: 'someSite', title: 'someTitle', suffix: false).tap do |meta|
|
131
|
-
expect(meta).to eq('<title>someSite |someTitle</title>')
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
it 'should use all custom options if available' do
|
136
|
-
subject.display_meta_tags({
|
137
|
-
site: 'someSite',
|
138
|
-
title: 'someTitle',
|
139
|
-
prefix: ' -',
|
140
|
-
suffix: '+ ',
|
141
|
-
separator: ':',
|
142
|
-
lowercase: true,
|
143
|
-
reverse: true,
|
144
|
-
}).tap do |meta|
|
145
|
-
expect(meta).to eq('<title>sometitle -:+ someSite</title>')
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
it 'should allow Arrays in title' do
|
150
|
-
subject.display_meta_tags(site: 'someSite', title: ['someTitle', 'anotherTitle']).tap do |meta|
|
151
|
-
expect(meta).to eq('<title>someSite | someTitle | anotherTitle</title>')
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'should allow Arrays in title with :lowercase' do
|
156
|
-
subject.display_meta_tags(site: 'someSite', title: ['someTitle', 'anotherTitle'], lowercase: true).tap do |meta|
|
157
|
-
expect(meta).to eq('<title>someSite | sometitle | anothertitle</title>')
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'should build title in reverse order if :reverse' do
|
162
|
-
subject.display_meta_tags({
|
163
|
-
site: 'someSite',
|
164
|
-
title: ['someTitle', 'anotherTitle'],
|
165
|
-
prefix: ' -',
|
166
|
-
suffix: '+ ',
|
167
|
-
separator: ':',
|
168
|
-
reverse: true,
|
169
|
-
}).tap do |meta|
|
170
|
-
expect(meta).to eq('<title>anotherTitle -:+ someTitle -:+ someSite</title>')
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
context '.display_title' do
|
176
|
-
it 'should display custom title if given' do
|
177
|
-
subject.title('someTitle')
|
178
|
-
subject.display_title(site: 'someSite', title: 'defaultTitle').tap do |meta|
|
179
|
-
expect(meta).to eq('someSite | someTitle')
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|