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,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper, 'displaying Twitter meta tags' do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
it 'should display meta tags specified with :twitter' do
|
7
|
-
subject.set_meta_tags(twitter: {
|
8
|
-
title: 'Twitter Share Title',
|
9
|
-
card: 'photo',
|
10
|
-
image: {
|
11
|
-
_: 'http://example.com/1.png',
|
12
|
-
width: 123,
|
13
|
-
height: 321,
|
14
|
-
}
|
15
|
-
})
|
16
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
17
|
-
expect(meta).to have_tag('meta', with: { content: "Twitter Share Title", name: "twitter:title" })
|
18
|
-
expect(meta).to have_tag('meta', with: { content: "photo", name: "twitter:card" })
|
19
|
-
expect(meta).to have_tag('meta', with: { content: "http://example.com/1.png", name: "twitter:image" })
|
20
|
-
expect(meta).to have_tag('meta', with: { content: "123", name: "twitter:image:width" })
|
21
|
-
expect(meta).to have_tag('meta', with: { content: "321", name: "twitter:image:height" })
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should display mirrored content" do
|
26
|
-
subject.set_meta_tags(title: 'someTitle')
|
27
|
-
subject.display_meta_tags(twitter: { title: :title }).tap do |meta|
|
28
|
-
expect(meta).to have_tag('meta', with: { content: "someTitle", name: "twitter:title" })
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/spec/view_helper_spec.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe MetaTags::ViewHelper do
|
4
|
-
subject { ActionView::Base.new }
|
5
|
-
|
6
|
-
context 'returning values' do
|
7
|
-
it 'should return title' do
|
8
|
-
expect(subject.title('some-title')).to eq('some-title')
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should return headline if specified' do
|
12
|
-
expect(subject.title('some-title', 'some-headline')).to eq('some-headline')
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should return title' do
|
16
|
-
expect(subject.title('some-title')).to eq('some-title')
|
17
|
-
expect(subject.title).to eq('some-title')
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should return description' do
|
21
|
-
expect(subject.description('some-description')).to eq('some-description')
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should return keywords' do
|
25
|
-
expect(subject.keywords('some-keywords')).to eq('some-keywords')
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should return noindex' do
|
29
|
-
expect(subject.noindex('some-noindex')).to eq('some-noindex')
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should return nofollow' do
|
33
|
-
expect(subject.noindex('some-nofollow')).to eq('some-nofollow')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'while handling string meta tag names' do
|
38
|
-
it 'should work with common parameters' do
|
39
|
-
subject.display_meta_tags('site' => 'someSite', 'title' => 'someTitle').tap do |meta|
|
40
|
-
expect(meta).to eq('<title>someSite | someTitle</title>')
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should work with open graph parameters' do
|
45
|
-
subject.set_meta_tags('og' => {
|
46
|
-
'title' => 'facebook title',
|
47
|
-
'description' => 'facebook description'
|
48
|
-
})
|
49
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
50
|
-
expect(meta).to have_tag('meta', with: { content: "facebook title", property: "og:title" })
|
51
|
-
expect(meta).to have_tag('meta', with: { content: "facebook description", property: "og:description" })
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should work with app links parameters' do
|
56
|
-
subject.set_meta_tags('al' => {
|
57
|
-
'ios' => {
|
58
|
-
'url' => 'applinks://docs',
|
59
|
-
'app_store_id' => 12345,
|
60
|
-
'app_name' => 'App Links'
|
61
|
-
}
|
62
|
-
})
|
63
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
64
|
-
expect(meta).to have_tag('meta', with: { content: "applinks://docs", property: "al:ios:url" })
|
65
|
-
expect(meta).to have_tag('meta', with: { content: "12345", property: "al:ios:app_store_id" })
|
66
|
-
expect(meta).to have_tag('meta', with: { content: "App Links", property: "al:ios:app_name" })
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'should work with facebook parameters' do
|
71
|
-
subject.set_meta_tags('fb' => {
|
72
|
-
app_id: 12345,
|
73
|
-
admins: "12345,23456"
|
74
|
-
})
|
75
|
-
subject.display_meta_tags(site: 'someSite').tap do |meta|
|
76
|
-
expect(meta).to have_tag('meta', with: { content: "12345", property: "fb:app_id" })
|
77
|
-
expect(meta).to have_tag('meta', with: { content: "12345,23456", property: "fb:admins" })
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
it_behaves_like '.set_meta_tags'
|
83
|
-
end
|