langalex-couch_potato 0.2.9 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## Changes
2
2
 
3
+ ### 0.2.10
4
+ * fixed bug with hardcoded timezone
5
+
3
6
  ### 0.2.9
4
7
 
5
8
  * allow to overwrite attribute accessor of properties and use super to call the original accessors
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 9
4
+ :patch: 11
data/lib/core_ext/time.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class Time
2
2
  def to_json(*a)
3
- %("#{strftime("%Y/%m/%d %H:%M:%S +0000")}")
3
+ %("#{strftime("%Y/%m/%d %H:%M:%S %z")}")
4
4
  end
5
5
 
6
6
  def self.json_create string
@@ -10,7 +10,7 @@ module CouchPotato
10
10
  end
11
11
 
12
12
  def method_missing(name, *args)
13
- if(value = _document[name.to_s])
13
+ if(value = _document && _document[name.to_s])
14
14
  value
15
15
  else
16
16
  super
@@ -23,8 +23,8 @@ describe "attributes" do
23
23
  end
24
24
 
25
25
  # useful when loading models from custom views
26
- describe "accessing non-property attributes" do
27
- it "should allow me to access attributes that are in the couchdb document " do
26
+ describe "accessing ghost attributes" do
27
+ it "should allow me to access attributes that are in the couchdb document but not defined as a property" do
28
28
  plant = Plant.json_create({"ruby_class" => "Plant", "color" => "red", "leaf_count" => 1})
29
29
  plant.color.should == 'red'
30
30
  end
@@ -35,6 +35,13 @@ describe "attributes" do
35
35
  plant.length
36
36
  end.should raise_error(NoMethodError)
37
37
  end
38
+
39
+ it "should raise a no method error if the document hasn't been loaded from the database" do
40
+ plant = Plant.new
41
+ lambda do
42
+ plant.length
43
+ end.should raise_error(NoMethodError, /undefined method `length'/)
44
+ end
38
45
  end
39
46
 
40
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: langalex-couch_potato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Lang