public
Description: <b>Please go to <a href="http://github.com/arunthampi/activecouch/">http://github.com/arunthampi/activecouch/</a> for the master repos.</b> ActiveCouch is a simple, convenient, Ruby-idiomatic wrapper for CouchDB
Homepage: http://code.google.com/p/activecouch/
Clone URL: git://github.com/chuyeow/activecouch.git
Search Repo:
- Removing zlibing while marshalling. This needs to be delegated to the 
application level
- More specs to verify whether update works
- Version 0.1.2 it is
arunthampi (author)
Tue Apr 08 02:20:34 -0700 2008
commit  d23dc3f648a4f89ed35aaf2aab76c2de3ecae44f
tree    ae3fdd4e37ed6c9375d04568356ed799e9496bc0
parent  f972caff87fbfd7ee7499c711e6f62d3de952960
...
1
 
...
 
1
0
@@ -1,2 +1,2 @@
0
-0.1.1
0
+0.1.2
...
162
163
164
165
 
166
167
168
169
170
171
 
172
173
174
...
162
163
164
 
165
166
167
168
169
170
 
171
172
173
174
0
@@ -162,13 +162,13 @@
0
 
0
     def marshal_dump # :nodoc:
0
       # Deflate using Zlib
0
- Zlib::Deflate.deflate(self.to_json)
0
+ self.to_json
0
     end
0
 
0
     def marshal_load(str) # :nodoc:
0
       self.instance_eval do
0
         # Inflate first, and then parse the JSON
0
- hash = JSON.parse(Zlib::Inflate.inflate(str))
0
+ hash = JSON.parse(str)
0
         initialize(hash)
0
       end
0
       self
...
20
21
22
23
 
24
25
26
27
28
29
 
30
31
32
...
58
59
60
61
 
62
63
64
...
20
21
22
 
23
24
25
26
27
28
 
29
30
31
32
...
58
59
60
 
61
62
63
64
0
@@ -20,13 +20,13 @@
0
   end
0
 
0
   it "should produce valid JSON output when sent the marshal_dump method" do
0
- Zlib::Deflate.stub!(:deflate).and_return("Deflated JSON")
0
+ @h.stub!(:to_json).and_return("Deflated JSON")
0
     @h.marshal_dump.should == 'Deflated JSON'
0
   end
0
   
0
   it "should produce valid JSON output when an attribute has been changed and the marshal_dump method is sent" do
0
     @h.rooms = 200
0
- Zlib::Deflate.stub!(:deflate).and_return("Deflated JSON, Part deux")
0
+ @h.stub!(:to_json).and_return("Deflated JSON, Part deux")
0
     @h.marshal_dump.should == 'Deflated JSON, Part deux'
0
   end
0
 end
0
@@ -58,7 +58,7 @@
0
 
0
   it "should produce valid JSON when sent the marshal_dump method" do
0
     # Stub the deflate method, which will basically give us the gzip'd JSON
0
- Zlib::Deflate.stub!(:deflate).and_return("Deflated JSON, Part three")
0
+ @c.stub!(:to_json).and_return("Deflated JSON, Part three")
0
     @c.marshal_dump.should == 'Deflated JSON, Part three'
0
   end
0
 end
...
32
33
34
35
36
 
 
37
38
39
40
...
42
43
44
45
46
47
 
48
49
50
...
32
33
34
 
 
35
36
37
38
39
40
...
42
43
44
 
45
 
46
47
48
49
0
@@ -32,8 +32,8 @@
0
   
0
   it "should instantiate an object when sent the marshal_load method with valid json as a parameter" do
0
     h = Hotel.new
0
- Zlib::Inflate.stub!(:inflate).and_return("{\"name\":\"Swissotel The Stamford\",\"rooms\":200,\"star_rating\":4.0}")
0
- h = h.marshal_load("About to get inflated!")
0
+
0
+ h = h.marshal_load("{\"name\":\"Swissotel The Stamford\",\"rooms\":200,\"star_rating\":4.0}")
0
     h.class.should == Hotel
0
     # Check whether all attributes are set correctly
0
     h.name.should == "Swissotel The Stamford"
0
0
@@ -42,9 +42,8 @@
0
   end
0
   
0
   it "should instantiate an object when sent the marshal_load method with valid JSON (containing associations) as a parameter" do
0
- Zlib::Inflate.stub!(:inflate).and_return('{"name":"Crazed McLovin","hospitals":[{"name":"Crazy Hospital 1"},{"name":"Crazy Hospital 2"}]}')
0
 
0
- crazy = CrazyPerson.new.marshal_load("About to get inflated! Part Deux")
0
+ crazy = CrazyPerson.new.marshal_load('{"name":"Crazed McLovin","hospitals":[{"name":"Crazy Hospital 1"},{"name":"Crazy Hospital 2"}]}')
0
     crazy.class.should == CrazyPerson
0
     
0
     crazy.name == "Crazed McLovin"
...
64
65
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
0
@@ -64,4 +64,28 @@
0
   end
0
   
0
 end
0
+
0
+
0
+describe "A new ActiveCouch::Base instance" do
0
+ before(:each) do
0
+ class Person < ActiveCouch::Base
0
+ site 'http://localhost:5984/'
0
+ has :name, :which_is => :text
0
+ end
0
+
0
+ @person = Person.new(:name => 'Seth')
0
+ # Create a database called people
0
+ ActiveCouch::Migrator.create_database('http://localhost:5984/', 'people')
0
+ # Save the document
0
+ @person.save
0
+ end
0
+
0
+ it "should be allowed to update a field and save again" do
0
+ @person.name = "McLovin"
0
+ @person.save.should == true
0
+
0
+ @person.name.should == "McLovin"
0
+ end
0
+end
0
+

Comments

    No one has commented yet.