0
@@ -20,20 +20,14 @@ describe "ActiveCouch::Base #marshal_dump method with just simple attributes" do
0
it "should produce valid JSON output when sent the marshal_dump method" do
0
- marshal_dump = @h.marshal_dump
0
- # Check for JSON regex, since attributes can appear in any order
0
- (marshal_dump =~ /"name":"Swissotel The Stamford"/).should_not == nil
0
- (marshal_dump =~ /"rooms":100/).should_not == nil
0
- (marshal_dump =~ /"star_rating":5.0/).should_not == nil
0
+ Zlib::Deflate.stub!(:deflate).and_return("Deflated JSON")
0
+ @h.marshal_dump.should == 'Deflated JSON'
0
it "should produce valid JSON output when an attribute has been changed and the marshal_dump method is sent" do
0
- marshal_dump = @h.marshal_dump
0
- # Check for JSON regex, since attributes can appear in any order
0
- (marshal_dump =~ /"name":"Swissotel The Stamford"/).should_not == nil
0
- (marshal_dump =~ /"rooms":200/).should_not == nil
0
- (marshal_dump =~ /"star_rating":5.0/).should_not == nil
0
+ Zlib::Deflate.stub!(:deflate).and_return("Deflated JSON, Part deux")
0
+ @h.marshal_dump.should == 'Deflated JSON, Part deux'
0
@@ -63,11 +57,8 @@ describe "ActiveCouch::Base #marshal_dump with associations" do
0
it "should produce valid JSON when sent the marshal_dump method" do
0
- marshal_dump = @c.marshal_dump
0
- # Check for JSON regex, since attributes can appear in any order
0
- (marshal_dump =~ /"name":"Crazed McLovin"/).should_not == nil
0
- (marshal_dump =~ /"hospitals":\[.*?\]/).should_not == nil
0
- (marshal_dump =~ /\{.*?"name":"Crazy Hospital 1".*?\}/).should_not == nil
0
- (marshal_dump =~ /\{.*?"name":"Crazy Hospital 2".*?\}/).should_not == nil
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.marshal_dump.should == 'Deflated JSON, Part three'
0
\ No newline at end of file
Comments
No one has commented yet.