mongoid-textile 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.1.1 - March 30, 2012
2
+
3
+ ### Resolved Issues
4
+
5
+ * Sets an empty hash to formatted translations field when field is localized and empty. @lucasrenan 3ae3e981d108013350988b659873f857a5beafcd
6
+
1
7
  ## 0.1.0 - February 14, 2012
2
8
 
3
9
  ### Improvements
data/Gemfile CHANGED
@@ -1,7 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'bson_ext', '~> 1.5.2'
4
- gem 'rake', '~> 0.9.2.2'
5
-
6
3
  # Specify your gem's dependencies in mongoid-textile.gemspec
7
4
  gemspec
data/Gemfile.lock CHANGED
@@ -9,41 +9,41 @@ GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  RedCloth (4.2.9)
12
- activemodel (3.2.1)
13
- activesupport (= 3.2.1)
12
+ activemodel (3.2.2)
13
+ activesupport (= 3.2.2)
14
14
  builder (~> 3.0.0)
15
- activesupport (3.2.1)
15
+ activesupport (3.2.2)
16
16
  i18n (~> 0.6)
17
17
  multi_json (~> 1.0)
18
- bson (1.5.2)
19
- bson_ext (1.5.2)
20
- bson (= 1.5.2)
18
+ bson (1.6.1)
19
+ bson_ext (1.6.1)
20
+ bson (~> 1.6.1)
21
21
  builder (3.0.0)
22
22
  diff-lcs (1.1.3)
23
23
  i18n (0.6.0)
24
- mongo (1.5.2)
25
- bson (= 1.5.2)
26
- mongoid (2.4.4)
24
+ mongo (1.6.1)
25
+ bson (~> 1.6.1)
26
+ mongoid (2.4.7)
27
27
  activemodel (~> 3.1)
28
28
  mongo (~> 1.3)
29
29
  tzinfo (~> 0.3.22)
30
- multi_json (1.0.4)
30
+ multi_json (1.2.0)
31
31
  rake (0.9.2.2)
32
- rspec (2.8.0)
33
- rspec-core (~> 2.8.0)
34
- rspec-expectations (~> 2.8.0)
35
- rspec-mocks (~> 2.8.0)
36
- rspec-core (2.8.0)
37
- rspec-expectations (2.8.0)
38
- diff-lcs (~> 1.1.2)
39
- rspec-mocks (2.8.0)
40
- tzinfo (0.3.31)
32
+ rspec (2.9.0)
33
+ rspec-core (~> 2.9.0)
34
+ rspec-expectations (~> 2.9.0)
35
+ rspec-mocks (~> 2.9.0)
36
+ rspec-core (2.9.0)
37
+ rspec-expectations (2.9.0)
38
+ diff-lcs (~> 1.1.3)
39
+ rspec-mocks (2.9.0)
40
+ tzinfo (0.3.32)
41
41
 
42
42
  PLATFORMS
43
43
  ruby
44
44
 
45
45
  DEPENDENCIES
46
- bson_ext (~> 1.5.2)
46
+ bson_ext (~> 1.6.1)
47
47
  mongoid-textile!
48
- rake (~> 0.9.2.2)
49
- rspec (~> 2.8.0)
48
+ rake (~> 0.9.2)
49
+ rspec (~> 2.9.0)
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Textile
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
@@ -16,8 +16,7 @@ module Mongoid
16
16
  field_name = textile_field_name.gsub(/_formatted/, '')
17
17
 
18
18
  if self.fields[field_name.to_s].localized?
19
- values = self.send("#{field_name}_translations")
20
-
19
+ values = self.send("#{field_name}_translations") || {}
21
20
  formatted_text = {}
22
21
 
23
22
  values.each do |key, value|
@@ -50,5 +49,6 @@ module Mongoid
50
49
  end
51
50
  end
52
51
  end
52
+
53
53
  end
54
- end
54
+ end
@@ -19,5 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.add_dependency 'mongoid', '~> 2.4.0'
20
20
  gem.add_dependency 'RedCloth', '~> 4.2.0'
21
21
 
22
- gem.add_development_dependency 'rspec', '~> 2.8.0'
22
+ gem.add_development_dependency 'bson_ext', '~> 1.6.1'
23
+ gem.add_development_dependency 'rspec', '~> 2.9.0'
24
+ gem.add_development_dependency 'rake', '~> 0.9.2'
23
25
  end
@@ -45,6 +45,15 @@ describe Mongoid::Textile do
45
45
  article.text_formatted.should eq("")
46
46
  end
47
47
  end
48
+
49
+ context "when text is localized and is not present" do
50
+ let(:post) { Post.create }
51
+
52
+ it "should set formatted translations field with an empty hash" do
53
+ post.text_formatted_translations.should eq({})
54
+ post.text_formatted.should eq(nil)
55
+ end
56
+ end
48
57
 
49
58
  context "when text is empty" do
50
59
  let(:article) { Article.create(:text => "") }
data/spec/spec_helper.rb CHANGED
@@ -14,8 +14,8 @@ RSpec.configure do |config|
14
14
 
15
15
  config.before :suite do
16
16
  Mongoid.configure do |config|
17
- config.master = Mongo::Connection.new.db("mongoid-textile")
18
- end
17
+ config.master = Mongo::Connection.new.db("mongoid-textile")
18
+ end
19
19
  end
20
20
 
21
21
  config.after :each do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-textile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-14 00:00:00.000000000 Z
13
+ date: 2012-03-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mongoid
17
- requirement: &2151854880 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: 2.4.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2151854880
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 2.4.0
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: RedCloth
28
- requirement: &2151853160 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ~>
@@ -33,18 +38,60 @@ dependencies:
33
38
  version: 4.2.0
34
39
  type: :runtime
35
40
  prerelease: false
36
- version_requirements: *2151853160
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 4.2.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: bson_ext
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.6.1
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 1.6.1
37
63
  - !ruby/object:Gem::Dependency
38
64
  name: rspec
39
- requirement: &2151851820 !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ version: 2.9.0
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
40
74
  none: false
41
75
  requirements:
42
76
  - - ~>
43
77
  - !ruby/object:Gem::Version
44
- version: 2.8.0
78
+ version: 2.9.0
79
+ - !ruby/object:Gem::Dependency
80
+ name: rake
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ version: 0.9.2
45
87
  type: :development
46
88
  prerelease: false
47
- version_requirements: *2151851820
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ~>
93
+ - !ruby/object:Gem::Version
94
+ version: 0.9.2
48
95
  description: Textile texts directly from MongoDB.
49
96
  email:
50
97
  - contato@lucasrenan.com
@@ -87,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
134
  version: '0'
88
135
  requirements: []
89
136
  rubyforge_project:
90
- rubygems_version: 1.8.10
137
+ rubygems_version: 1.8.19
91
138
  signing_key:
92
139
  specification_version: 3
93
140
  summary: Mongoid Textile caches Textile texts on MongoDB to eliminate reprocessing.