ref: master
plugins/metadata/test/functional/home_controller_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
require 'test_helper' class HomeControllerTest < ActionController::TestCase def setup @controller = HomeController.new @environment = Environment.default @environment.enabled_plugins += ['MetadataPlugin'] @environment.save! end should 'display meta tags for social media' do get :index assert_tag :tag => 'meta', :attributes => { :name => 'twitter:card', :content => 'summary' } assert_tag :tag => 'meta', :attributes => { :name => 'twitter:title', :content => assigns(:environment).name } assert_tag :tag => 'meta', :attributes => { :name => 'twitter:description', :content => assigns(:environment).name } assert_no_tag :tag => 'meta', :attributes => { :name => 'twitter:image' } assert_tag :tag => 'meta', :attributes => { :property => 'og:type', :content => 'website' } assert_tag :tag => 'meta', :attributes => { :property => 'og:url', :content => assigns(:environment).top_url } assert_tag :tag => 'meta', :attributes => { :property => 'og:title', :content => assigns(:environment).name } assert_tag :tag => 'meta', :attributes => { :property => 'og:site_name', :content => assigns(:environment).name } assert_tag :tag => 'meta', :attributes => { :property => 'og:description', :content => assigns(:environment).name } assert_no_tag :tag => 'meta', :attributes => { :property => 'article:published_time' } assert_no_tag :tag => 'meta', :attributes => { :property => 'og:image' } end end |