spec/unit/berkshelf/uploader_spec.rb in berkshelf-0.4.0 vs spec/unit/berkshelf/uploader_spec.rb in berkshelf-0.5.0.rc1

- old
+ new

@@ -1,32 +1,14 @@ require 'spec_helper' module Berkshelf describe Uploader do - subject { Uploader.new(Chef::Config[:chef_server_url], client_key: Chef::Config[:client_key], node_name: Chef::Config[:node_name]) } + subject { Uploader.new(server_url: Chef::Config[:chef_server_url], client_key: Chef::Config[:client_key], client_name: Chef::Config[:node_name]) } describe "#upload" do let(:cookbook) { double('nginx', name: "nginx-0.101.2", cookbook_name: "nginx", version: "0.101.2") } - context "when cookbook is valid" do - before(:each) do - cookbook.should_receive(:validate!).and_return(true) - cookbook.should_receive(:checksums).and_return( - "da97c94bb6acb2b7900cbf951654fea3" => - File.expand_path("spec/fixtures/cookbooks/example_cookbook-0.5.0/recipes/default.rb") - ) - subject.should_receive(:create_sandbox) - subject.should_receive(:upload_checksums_to_sandbox) - subject.should_receive(:commit_sandbox) - subject.should_receive(:save_cookbook) - end - - it "returns true" do - subject.upload(cookbook).should be_true - end - end - - context "when cookbook is not valid" do + context "when cookbook is invalid" do before(:each) { cookbook.should_receive(:validate!).and_raise(CookbookSyntaxError) } it "raises a CookbookSyntaxError error" do lambda { subject.upload(cookbook)