langalex-couch_potato 0.2.9 → 0.2.11
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 +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
|