factor out couchrest::document
This commit is contained in:
parent
a6f285adfa
commit
0ce716518f
4 changed files with 59 additions and 8 deletions
29
spec/couchrest/core/document_spec.rb
Normal file
29
spec/couchrest/core/document_spec.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
require File.dirname(__FILE__) + '/../../spec_helper'
|
||||
|
||||
describe CouchRest::Document, "[]=" do
|
||||
before(:each) do
|
||||
@doc = CouchRest::Document.new
|
||||
end
|
||||
it "should work" do
|
||||
@doc["enamel"].should == nil
|
||||
@doc["enamel"] = "Strong"
|
||||
@doc["enamel"].should == "Strong"
|
||||
end
|
||||
it "[]= should convert to string" do
|
||||
@doc["enamel"].should == nil
|
||||
@doc[:enamel] = "Strong"
|
||||
@doc["enamel"].should == "Strong"
|
||||
end
|
||||
it "should read as a string" do
|
||||
@doc[:enamel] = "Strong"
|
||||
@doc[:enamel].should == "Strong"
|
||||
end
|
||||
end
|
||||
|
||||
describe CouchRest::Document, "new" do
|
||||
it "should create itself from a Hash" do
|
||||
@doc = CouchRest::Document.new("key" => [1,2,3], :more => "values")
|
||||
@doc["key"].should == [1,2,3]
|
||||
@doc["more"].should == "values"
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue