Increase social media meta tags spec

This commit is contained in:
Bertocq
2017-11-27 13:24:07 +01:00
parent 8bef6d81c8
commit 33f47e7a63

View File

@@ -4,27 +4,50 @@ feature 'Social media meta tags' do
context 'Setting social media meta tags' do context 'Setting social media meta tags' do
let(:meta_keywords) { 'citizen, participation, open government' }
let(:meta_title) { 'CONSUL TEST' }
let(:meta_description) { 'Citizen Participation and Open Government Application' }
let(:twitter_handle) { '@consul_test' }
let(:url) { 'http://consul.dev' }
let(:facebook_handle) { 'consultest' }
let(:org_name) { 'CONSUL TEST' }
before do before do
Setting['meta_keywords'] = "citizen, participation, open government" Setting['meta_keywords'] = meta_keywords
Setting['meta_title'] = "CONSUL" Setting['meta_title'] = meta_title
Setting['meta_description'] = "Citizen Participation and Open Government Application" Setting['meta_description'] = meta_description
Setting['twitter_handle'] = twitter_handle
Setting['url'] = url
Setting['facebook_handle'] = facebook_handle
Setting['org_name'] = org_name
end end
after do after do
Setting['meta_keywords'] = nil Setting['meta_keywords'] = nil
Setting['meta_title'] = nil Setting['meta_title'] = nil
Setting['meta_description'] = nil Setting['meta_description'] = nil
Setting['twitter_handle'] = nil
Setting['url'] = 'http://example.com'
Setting['facebook_handle'] = nil
Setting['org_name'] = 'CONSUL'
end end
scenario 'Social media meta tags partial render settings content' do scenario 'Social media meta tags partial render settings content' do
visit root_path visit root_path
expect(page).to have_css 'meta[name="keywords"][content="citizen, participation, open government"]', visible: false expect(page).to have_css 'meta[name="keywords"][content="'+ meta_keywords + '"]', visible: false
expect(page).to have_css 'meta[name="twitter:title"][content="CONSUL"]', visible: false expect(page).to have_css 'meta[name="twitter:site"][content="'+ twitter_handle + '"]', visible: false
expect(page).to have_css 'meta[name="twitter:title"][content="CONSUL"]', visible: false expect(page).to have_css 'meta[name="twitter:title"][content="'+ meta_title + '"]', visible: false
expect(page).to have_css 'meta[property="og:title"][content="CONSUL"]', visible: false expect(page).to have_css 'meta[name="twitter:description"][content="' + meta_description + '"]', visible: false
expect(page).to have_css 'meta[property="og:description"][content="Citizen Participation and Open Government Application"]', visible: false expect(page).to have_css 'meta[name="twitter:image"][content="http://www.example.com/social_media_icon_twitter.png"]', visible: false
expect(page).to have_css 'meta[property="og:title"][content="'+ meta_title + '"]', visible: false
expect(page).to have_css 'meta[property="article:publisher"][content="' + url + '"]', visible: false
expect(page).to have_css 'meta[property="article:author"][content="https://www.facebook.com/' + facebook_handle + '"]', visible: false
expect(page).to have_css 'meta[property="og:url"][content="http://www.example.com/"]', visible: false
expect(page).to have_css 'meta[property="og:image"][content="http://www.example.com/social_media_icon.png"]', visible: false
expect(page).to have_css 'meta[property="og:site_name"][content="' + org_name + '"]', visible: false
expect(page).to have_css 'meta[property="og:description"][content="' + meta_description + '"]', visible: false
end end
end end