has_seo_fields 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/has_seo_fields/version.rb +1 -1
- data/lib/has_seo_fields.rb +1 -4
- data/spec/lib/has_seo_fields_spec.rb +5 -1
- metadata +3 -3
data/lib/has_seo_fields.rb
CHANGED
@@ -21,7 +21,7 @@ module HasSeoFields
|
|
21
21
|
define_method "#{getter_name}=" do |value|
|
22
22
|
if (field = seo_fields.find_by_name getter_name)
|
23
23
|
field.update_attribute :value, value
|
24
|
-
|
24
|
+
elsif value.present?
|
25
25
|
seo_fields.create :name => getter_name, :value => value
|
26
26
|
end
|
27
27
|
end
|
@@ -30,9 +30,6 @@ module HasSeoFields
|
|
30
30
|
const_set "SEO_NAMES", args
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
34
|
-
module InstanceMethods
|
35
|
-
end
|
36
33
|
end
|
37
34
|
|
38
35
|
ActiveRecord::Base.send :include, HasSeoFields
|
@@ -22,7 +22,6 @@ describe HasSeoFields do
|
|
22
22
|
it "returns nil if nothing founded" do
|
23
23
|
subject.seo_title.should be_nil
|
24
24
|
end
|
25
|
-
|
26
25
|
end
|
27
26
|
|
28
27
|
context "setters" do
|
@@ -38,6 +37,11 @@ describe HasSeoFields do
|
|
38
37
|
subject.seo_fields.should have(1).item
|
39
38
|
subject.seo_fields.find_by_name('seo_h1_tag').value.should eql('Cool city')
|
40
39
|
end
|
40
|
+
|
41
|
+
it "does not creates entries with empty strings as values" do
|
42
|
+
subject.seo_h1_tag=''
|
43
|
+
subject.seo_fields.should have(0).items
|
44
|
+
end
|
41
45
|
end
|
42
46
|
|
43
47
|
describe "already exists" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_seo_fields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nick Erlikh
|