diaspora/spec/helpers/open_graph_helper_spec.rb
Denis Hovart bcace2def2 6840 : meta tags update (#6998)
* Adds a new metadata helper and methods to PostPresenter to have metas on post pages.

* Adds tests to post controller to check correctness of metas

* Add methods to PersonPresenter to have metas on profile pages

* Correct meta data helper test

* Update PersonPresenter, add test to PeopleController

* Creates TagPresenter. Display tag metas on tag index page

* Updata meta data helper spec

* Not displaying bio as the description meta on profile page for now. Privacy concerns to be cleared.

* Set meta info as hashes in presenters

* Move original hardcoded metas info to config/defaults.yml

* metas_tags include by default the general metas, update views

* Update code style, clean views

* Renames TagPresenter StreamTagPresenter, updates TagController spec

* Add a default_metas entry to diaspora.yml.example

* Align metas hash in presenters, refactor meta data helper

* Use bio as description meta if user has a public profile

* Rename StreamTagPresenter to TagStreamPresenter
2016-08-18 21:52:39 +02:00

32 lines
1,007 B
Ruby

require 'spec_helper'
describe OpenGraphHelper, :type => :helper do
describe 'og_html' do
scenarios = {
"article" => {
"url" => "http://opengraph-enabled-site.com/articles/1332-scientists-discover-new-planet",
"image" => "http://opengraph-enabled-site.com/images/1332-lead.jpg",
"title" => "Scientists discover new planet",
"description" => "A new planet was found yesterday"
},
}
scenarios.each do |type, data|
specify 'for type "'+type+'"' do
cache = OpenGraphCache.new(:url => data['url'])
cache.ob_type = type
cache.image = data['image']
cache.title = data['title']
cache.description = data['description']
formatted = og_html(cache)
expect(formatted).to match(/#{data['url']}/)
expect(formatted).to match(/#{data['title']}/)
expect(formatted).to match(/#{data['image']}/)
expect(formatted).to match(/#{data['description']}/)
end
end
end
end