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 +3 -0
- data/VERSION.yml +1 -1
- data/lib/core_ext/time.rb +1 -1
- data/lib/couch_potato/persistence/ghost_attributes.rb +1 -1
- data/spec/unit/attributes_spec.rb +9 -2
- metadata +1 -1
data/CHANGES.md
CHANGED
data/VERSION.yml
CHANGED
data/lib/core_ext/time.rb
CHANGED
@@ -23,8 +23,8 @@ describe "attributes" do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# useful when loading models from custom views
|
26
|
-
describe "accessing
|
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
|