diff options
Diffstat (limited to 'chef/spec/unit/node_spec.rb')
-rw-r--r-- | chef/spec/unit/node_spec.rb | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/chef/spec/unit/node_spec.rb b/chef/spec/unit/node_spec.rb index 4577d5098b..b6f63c9651 100644 --- a/chef/spec/unit/node_spec.rb +++ b/chef/spec/unit/node_spec.rb @@ -681,80 +681,4 @@ describe Chef::Node do end end - describe "acting as a CouchDB-backed model" do - before(:each) do - @couchdb = Chef::CouchDB.new - @mock_couch = mock('couch mock') - end - - describe "list" do - before(:each) do - @mock_couch.stub!(:list).and_return( - { "rows" => [ { "value" => "a", "key" => "avenue" } ] } - ) - Chef::CouchDB.stub!(:new).and_return(@mock_couch) - end - - it "should retrieve a list of nodes from CouchDB" do - Chef::Node.cdb_list.should eql(["avenue"]) - end - - it "should return just the ids if inflate is false" do - Chef::Node.cdb_list(false).should eql(["avenue"]) - end - - it "should return the full objects if inflate is true" do - Chef::Node.cdb_list(true).should eql(["a"]) - end - end - - describe "when loading a given node" do - it "should load a node from couchdb by name" do - @couchdb.should_receive(:load).with("node", "coffee").and_return(true) - Chef::CouchDB.stub!(:new).and_return(@couchdb) - Chef::Node.cdb_load("coffee") - end - end - - describe "when destroying a Node" do - it "should delete this node from couchdb" do - @couchdb.should_receive(:delete).with("node", "bob", 1).and_return(true) - Chef::CouchDB.stub!(:new).and_return(@couchdb) - node = Chef::Node.new - node.name "bob" - node.couchdb_rev = 1 - node.cdb_destroy - end - end - - describe "when saving a Node" do - before(:each) do - @couchdb.stub!(:store).and_return({ "rev" => 33 }) - Chef::CouchDB.stub!(:new).and_return(@couchdb) - @node = Chef::Node.new - @node.name "bob" - @node.couchdb_rev = 1 - end - - it "should save the node to couchdb" do - @couchdb.should_receive(:store).with("node", "bob", @node).and_return({ "rev" => 33 }) - @node.cdb_save - end - - it "should store the new couchdb_rev" do - @node.cdb_save - @node.couchdb_rev.should eql(33) - end - end - - describe "create_design_document" do - it "should create our design document" do - @couchdb.should_receive(:create_design_document).with("nodes", Chef::Node::DESIGN_DOCUMENT) - Chef::CouchDB.stub!(:new).and_return(@couchdb) - Chef::Node.create_design_document - end - end - - end - end |