crystalmeta 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.markdown +5 -0
- data/lib/crystal/options_for_controller.rb +1 -2
- data/lib/crystal/tag.rb +4 -0
- data/lib/crystal/version.rb +1 -1
- data/lib/crystal/view_helpers.rb +1 -1
- data/spec/dummy/config/locales/en.yml +1 -0
- data/spec/features/meta_tags_spec.rb +6 -2
- data/spec/unit/tag_spec.rb +7 -1
- metadata +2 -2
data/CHANGELOG.markdown
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
### 0.9.4 2013-02-28
|
2
|
+
|
3
|
+
* Fix bugs with displaying tags: a tag key name should be `property` for OpenGraph & `name` for anything else, value should be called `content`
|
4
|
+
* Remove default value for `twitter:url` — it has an OpenGraph fallback to `og:url`
|
5
|
+
|
1
6
|
### 0.9.3 2013-02-03
|
2
7
|
|
3
8
|
* Fix interpolation bug
|
data/lib/crystal/tag.rb
CHANGED
data/lib/crystal/version.rb
CHANGED
data/lib/crystal/view_helpers.rb
CHANGED
@@ -6,7 +6,7 @@ module Crystal
|
|
6
6
|
|
7
7
|
def meta_tags(pattern = //)
|
8
8
|
meta.tags_by_pattern(pattern).map{|t|
|
9
|
-
tag(:meta,
|
9
|
+
tag(:meta, t.name_key => t.name, :content => t.value_for_context(self))
|
10
10
|
}.join("\n").html_safe
|
11
11
|
end
|
12
12
|
end
|
@@ -2,11 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'meta tags' do
|
4
4
|
def meta_tags(pattern = //)
|
5
|
-
all('meta').select{|meta| pattern === meta[:property]}
|
5
|
+
all('meta').select{|meta| pattern === meta[:property] || pattern === meta[:name] }
|
6
6
|
end
|
7
7
|
|
8
8
|
def value_for(pattern = //)
|
9
|
-
meta_tags(pattern).first[:
|
9
|
+
meta_tags(pattern).first[:content]
|
10
10
|
end
|
11
11
|
|
12
12
|
def title
|
@@ -26,6 +26,10 @@ describe 'meta tags' do
|
|
26
26
|
value_for('og:image').should == '/images/rock.jpg'
|
27
27
|
end
|
28
28
|
|
29
|
+
it 'include og:image from locale' do
|
30
|
+
value_for('twitter:card').should == 'summary'
|
31
|
+
end
|
32
|
+
|
29
33
|
it 'include og:type from controller defaults' do
|
30
34
|
value_for('og:type').should == 'video.movie'
|
31
35
|
end
|
data/spec/unit/tag_spec.rb
CHANGED
@@ -4,8 +4,14 @@ describe Crystal::Tag do
|
|
4
4
|
subject { Crystal::Tag.new('og:title', 'Caesar must die') }
|
5
5
|
its(:name) {should == 'og:title'}
|
6
6
|
its(:value) {should == 'Caesar must die'}
|
7
|
+
its(:name_key) { should == :property }
|
7
8
|
|
8
|
-
context '
|
9
|
+
context 'for twitter' do
|
10
|
+
subject { Crystal::Tag.new('twitter:title', 'Caesar must die') }
|
11
|
+
its(:name_key) { should == :name }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#value_for_context' do
|
9
15
|
let(:context) { double }
|
10
16
|
|
11
17
|
it 'returns asset path if asset' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crystalmeta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|