Skip to content

Commit dcfa654

Browse files
committed
Making the couchdb_spec.rb reflect the need to create the database before you create a view
1 parent 55d27b8 commit dcfa654

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

chef/spec/unit/couchdb_spec.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,17 @@ def do_create_db
9191
@mock_rest.stub!(:get_rest).and_return(@mock_design)
9292
@mock_rest.stub!(:put_rest).and_return(true)
9393
Chef::REST.stub!(:new).and_return(@mock_rest)
94+
@couchdb = Chef::CouchDB.new
95+
@couchdb.stub!(:create_db).and_return(true)
9496
end
9597

9698
def do_create_design_document
97-
couchdb = Chef::CouchDB.new
98-
couchdb.create_design_document("bob", @mock_data)
99+
@couchdb.create_design_document("bob", @mock_data)
100+
end
101+
102+
it "should create the database if it does not exist" do
103+
@couchdb.should_receive(:create_db).and_return(true)
104+
do_create_design_document
99105
end
100106

101107
it "should fetch the existing design document" do

0 commit comments

Comments
 (0)