couch_potato 0.5.3 → 0.5.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/CHANGES.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## Changes
2
2
 
3
+ ### 0.5.4
4
+ * cast 'false' to false for boolean properties (langalex)
5
+
3
6
  ### 0.5.3
4
7
  * added CouchPotato::Database.load! (langalex)
5
8
 
@@ -14,7 +14,7 @@ module CouchPotato
14
14
  def cast_boolean(value)
15
15
  if [FalseClass, TrueClass].include?(value.class) || value.nil?
16
16
  value
17
- elsif [0, '0'].include?(value)
17
+ elsif [0, '0', 'false'].include?(value)
18
18
  false
19
19
  else
20
20
  true
@@ -1,3 +1,3 @@
1
1
  module CouchPotato
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
@@ -200,7 +200,7 @@ describe 'properties' do
200
200
  end
201
201
 
202
202
  describe "boolean properties" do
203
- it "should persist '0' for false" do
203
+ it "should persist '0' as false" do
204
204
  a = Address.new
205
205
  a.verified = '0'
206
206
  CouchPotato.database.save_document! a
@@ -208,7 +208,7 @@ describe 'properties' do
208
208
  a.verified.should be_false
209
209
  end
210
210
 
211
- it "should persist 0 for false" do
211
+ it "should persist 0 as false" do
212
212
  a = Address.new
213
213
  a.verified = 0
214
214
  CouchPotato.database.save_document! a
@@ -216,7 +216,15 @@ describe 'properties' do
216
216
  a.verified.should be_false
217
217
  end
218
218
 
219
- it "should persist '1' for true" do
219
+ it "should persist 'false' as false" do
220
+ a = Address.new
221
+ a.verified = 'false'
222
+ CouchPotato.database.save_document! a
223
+ a = CouchPotato.database.load_document a.id
224
+ a.verified.should be_false
225
+ end
226
+
227
+ it "should persist '1' as true" do
220
228
  a = Address.new
221
229
  a.verified = '1'
222
230
  CouchPotato.database.save_document! a
@@ -224,7 +232,7 @@ describe 'properties' do
224
232
  a.verified.should be_true
225
233
  end
226
234
 
227
- it "should persist 1 for true" do
235
+ it "should persist 1 as true" do
228
236
  a = Address.new
229
237
  a.verified = 1
230
238
  CouchPotato.database.save_document! a
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: couch_potato
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.3
5
+ version: 0.5.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alexander Lang
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-27 00:00:00 +02:00
13
+ date: 2011-04-29 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency