Sha256: 1b552afa52b762bebfc44f015768a84bc758894f546dde2c5b7af9b89333d3d3

Contents?: true

Size: 1.36 KB

Versions: 9

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

module Berkshelf
  describe Uploader do
    let(:server_url) { "https://api.opscode.com/organizations/vialstudios" }
    let(:client_key) { '/Users/reset/.chef/reset.pem' }
    let(:node_name) { 'reset' }

    subject { Uploader.new(server_url, client_key: client_key, node_name: 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"=>"/Users/reset/code/berkshelf/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 a successful TXResult" do
          subject.upload(cookbook).should be_success
        end
      end

      context "when cookbook is not valid" do
        before(:each) { cookbook.should_receive(:validate!).and_raise(CookbookSyntaxError) }

        it "returns a failed TXResult" do
          subject.upload(cookbook).should be_failed
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
berkshelf-0.3.3 spec/unit/berkshelf/uploader_spec.rb
berkshelf-0.3.2 spec/unit/berkshelf/uploader_spec.rb
berkshelf-0.3.1 spec/unit/berkshelf/uploader_spec.rb
berkshelf-0.3.0 spec/unit/berkshelf/uploader_spec.rb
berkshelf-0.2.0 spec/unit/berkshelf/uploader_spec.rb
berkshelf-0.1.5 spec/unit/berkshelf/uploader_spec.rb
berkshelf-0.1.4 spec/unit/berkshelf/uploader_spec.rb
berkshelf-0.1.3 spec/unit/berkshelf/uploader_spec.rb
berkshelf-0.1.2 spec/unit/berkshelf/uploader_spec.rb