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.
@@ -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
@@ -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