mongoid_i18n 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -16,8 +16,8 @@ begin
16
16
  gem.email = "papipo@gmail.com"
17
17
  gem.homepage = "http://github.com/Papipo/mongoid_i18n"
18
18
  gem.authors = ["Rodrigo Álvarez"]
19
- gem.add_dependency "mongoid", '>= 2.0.0.beta.20'
20
- gem.add_development_dependency "rspec", "2.1.0"
19
+ gem.add_dependency "mongoid", '>= 2.0.0'
20
+ gem.add_development_dependency "rspec"
21
21
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
22
22
  end
23
23
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/mongoid_i18n.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongoid_i18n}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rodrigo \303\201lvarez"]
@@ -55,8 +55,8 @@ Gem::Specification.new do |s|
55
55
  s.add_runtime_dependency(%q<mocha>, [">= 0"])
56
56
  s.add_runtime_dependency(%q<jeweler>, [">= 0"])
57
57
  s.add_runtime_dependency(%q<bundler>, [">= 0"])
58
- s.add_runtime_dependency(%q<mongoid>, [">= 2.0.0.beta.20"])
59
- s.add_development_dependency(%q<rspec>, ["= 2.1.0"])
58
+ s.add_runtime_dependency(%q<mongoid>, [">= 2.0.0"])
59
+ s.add_development_dependency(%q<rspec>, [">= 0"])
60
60
  else
61
61
  s.add_dependency(%q<bson_ext>, ["~> 1.2"])
62
62
  s.add_dependency(%q<mongoid>, [">= 2.0.0"])
@@ -64,8 +64,8 @@ Gem::Specification.new do |s|
64
64
  s.add_dependency(%q<mocha>, [">= 0"])
65
65
  s.add_dependency(%q<jeweler>, [">= 0"])
66
66
  s.add_dependency(%q<bundler>, [">= 0"])
67
- s.add_dependency(%q<mongoid>, [">= 2.0.0.beta.20"])
68
- s.add_dependency(%q<rspec>, ["= 2.1.0"])
67
+ s.add_dependency(%q<mongoid>, [">= 2.0.0"])
68
+ s.add_dependency(%q<rspec>, [">= 0"])
69
69
  end
70
70
  else
71
71
  s.add_dependency(%q<bson_ext>, ["~> 1.2"])
@@ -74,8 +74,8 @@ Gem::Specification.new do |s|
74
74
  s.add_dependency(%q<mocha>, [">= 0"])
75
75
  s.add_dependency(%q<jeweler>, [">= 0"])
76
76
  s.add_dependency(%q<bundler>, [">= 0"])
77
- s.add_dependency(%q<mongoid>, [">= 2.0.0.beta.20"])
78
- s.add_dependency(%q<rspec>, ["= 2.1.0"])
77
+ s.add_dependency(%q<mongoid>, [">= 2.0.0"])
78
+ s.add_dependency(%q<rspec>, [">= 0"])
79
79
  end
80
80
  end
81
81
 
@@ -27,6 +27,10 @@ describe Mongoid::I18n, "localized_field" do
27
27
  before do
28
28
  @entry = Entry.new(:title => 'Title')
29
29
  end
30
+
31
+ it "should return that value" do
32
+ @entry.title.should == 'Title'
33
+ end
30
34
 
31
35
  describe "and persisted" do
32
36
  before do
@@ -46,10 +50,6 @@ describe Mongoid::I18n, "localized_field" do
46
50
  end
47
51
  end
48
52
 
49
- it "should return that value" do
50
- @entry.title.should == 'Title'
51
- end
52
-
53
53
  describe "when the locale is changed" do
54
54
  before do
55
55
  I18n.locale = :es
@@ -71,10 +71,10 @@ describe Mongoid::I18n, "localized_field" do
71
71
  describe "persisted and retrieved from db" do
72
72
  before do
73
73
  @entry.save
74
- @entry = Entry.find(:first, :conditions => {:title => 'Título'})
74
+ @entry.reload
75
75
  end
76
76
 
77
- it "the localized field value should be ok" do
77
+ it "the localized field value should be correct" do
78
78
  @entry.title.should == 'Título'
79
79
  I18n.locale = :en
80
80
  @entry.title.should == 'Title'
@@ -82,18 +82,18 @@ describe Mongoid::I18n, "localized_field" do
82
82
  end
83
83
  end
84
84
 
85
- describe "getter.translations" do
85
+ describe "field_translations" do
86
86
  it "should return all translations" do
87
87
  @entry.title_translations.should == {'en' => 'Title', 'es' => 'Título'}
88
88
  end
89
89
  end
90
90
 
91
- describe "getter.translations=" do
91
+ describe "with mass-assigned translations" do
92
92
  before do
93
93
  @entry.title_translations = {'en' => 'New title', 'es' => 'Nuevo título'}
94
94
  end
95
95
 
96
- it "should accept new translations" do
96
+ it "should set all translations" do
97
97
  @entry.title_translations.should == {'en' => 'New title', 'es' => 'Nuevo título'}
98
98
  end
99
99
 
@@ -102,7 +102,7 @@ describe Mongoid::I18n, "localized_field" do
102
102
  end
103
103
  end
104
104
 
105
- describe "and we go back to the original locale" do
105
+ describe "if we go back to the original locale" do
106
106
  before do
107
107
  I18n.locale = :en
108
108
  end
@@ -116,7 +116,7 @@ describe Mongoid::I18n, "localized_field" do
116
116
  end
117
117
  end
118
118
 
119
- describe Mongoid::I18n, 'criteria on embeds_many association' do
119
+ describe Mongoid::I18n, 'localized field in embedded association' do
120
120
  before do
121
121
  class Entry
122
122
  embeds_many :sub_entries
@@ -137,7 +137,7 @@ describe Mongoid::I18n, 'criteria on embeds_many association' do
137
137
  end
138
138
  end
139
139
 
140
- describe Mongoid::I18n, 'criteria on embeds_one association' do
140
+ describe Mongoid::I18n, 'localized field in embedded document' do
141
141
  before do
142
142
  class Entry
143
143
  embeds_one :sub_entry
@@ -150,13 +150,10 @@ describe Mongoid::I18n, 'criteria on embeds_one association' do
150
150
  embedded_in :entry, :inverse_of => :sub_entries
151
151
  end
152
152
  @entry = Entry.new
153
+ @entry.create_sub_entry(:subtitle => 'Oxford Street')
153
154
  end
154
155
 
155
156
  it "should store the title in the right locale" do
156
- @entry.create_sub_entry(:subtitle => "Oxford Street")
157
-
158
- @entry.reload
159
-
160
- @entry.sub_entry.subtitle.should == 'Oxford Street'
157
+ @entry.reload.sub_entry.subtitle.should == 'Oxford Street'
161
158
  end
162
159
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_i18n
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Rodrigo \xC3\x81lvarez"
@@ -113,14 +113,12 @@ dependencies:
113
113
  requirements:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
- hash: 62196427
116
+ hash: 15
117
117
  segments:
118
118
  - 2
119
119
  - 0
120
120
  - 0
121
- - beta
122
- - 20
123
- version: 2.0.0.beta.20
121
+ version: 2.0.0
124
122
  name: mongoid
125
123
  version_requirements: *id007
126
124
  - !ruby/object:Gem::Dependency
@@ -129,14 +127,12 @@ dependencies:
129
127
  requirement: &id008 !ruby/object:Gem::Requirement
130
128
  none: false
131
129
  requirements:
132
- - - "="
130
+ - - ">="
133
131
  - !ruby/object:Gem::Version
134
- hash: 11
132
+ hash: 3
135
133
  segments:
136
- - 2
137
- - 1
138
134
  - 0
139
- version: 2.1.0
135
+ version: "0"
140
136
  name: rspec
141
137
  version_requirements: *id008
142
138
  description: "This gem aims to be a transparent way to deal with localizable fields.\n Basically use localized_field() instead of field() and that's it.\n It will take care of locales for you when using find or criteria.\n "