diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-12-25 01:03:54 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-12-25 01:11:08 +0300 |
commit | ab3d855c0e1869fd1986c3bcdf7519f6b1cf1fa8 (patch) | |
tree | 7d0a1117b4cae0660004c00684dcbab1cde4069a /spec/helpers/page_layout_helper_spec.rb | |
parent | 99dc1fce5ed84fb78bd993423db9c470021ea3a2 (diff) |
Add support for `twitter:label` meta tags
Diffstat (limited to 'spec/helpers/page_layout_helper_spec.rb')
-rw-r--r-- | spec/helpers/page_layout_helper_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/helpers/page_layout_helper_spec.rb b/spec/helpers/page_layout_helper_spec.rb index 530e9bab343..fd7107779f6 100644 --- a/spec/helpers/page_layout_helper_spec.rb +++ b/spec/helpers/page_layout_helper_spec.rb @@ -97,4 +97,33 @@ describe PageLayoutHelper do end end end + + describe 'page_card_attributes' do + it 'raises ArgumentError when given more than two attributes' do + map = { foo: 'foo', bar: 'bar', baz: 'baz' } + + expect { helper.page_card_attributes(map) }. + to raise_error(ArgumentError, /more than two attributes/) + end + + it 'rejects blank values' do + map = { foo: 'foo', bar: '' } + helper.page_card_attributes(map) + + expect(helper.page_card_attributes).to eq({ foo: 'foo' }) + end + end + + describe 'page_card_meta_tags' do + it 'returns the twitter:label and twitter:data tags' do + allow(helper).to receive(:page_card_attributes).and_return(foo: 'bar') + + tags = helper.page_card_meta_tags + + aggregate_failures do + expect(tags).to include %q(<meta property="twitter:label1" content="foo" />) + expect(tags).to include %q(<meta property="twitter:data1" content="bar" />) + end + end + end end |