Sha256: 131ae8c1868ba4dfafd62cca229c7babcc85e52511c34cd63e63fae688bf2503

Contents?: true

Size: 940 Bytes

Versions: 3

Compression:

Stored size: 940 Bytes

Contents

require 'spec_helper'

describe GroupDocs::Storage::Package do

  it_behaves_like GroupDocs::Api::Entity

  it { should have_accessor(:name)    }
  it { should have_accessor(:objects) }

  describe '#add' do
    it 'adds objects to be packed later' do
      subject.objects = ['object 1']
      subject.objects.should_receive(:<<).with('object 2')
      subject.add('object 2')
    end

    it 'is aliased to #<<' do
      subject.should have_alias(:<<, :add)
    end
  end

  describe '#create!' do
    before(:each) do
      mock_api_server(load_json('package_create'))
      subject.objects = [stub(:name => 'object 1')]
    end

    it 'accepts access credentials hash' do
      lambda do
        subject.create!(:client_id => 'client_id', :private_key => 'private_key')
      end.should_not raise_error(ArgumentError)
    end

    it 'returns URL for package downloading' do
      subject.create!.should be_a(String)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
groupdocs-1.4.1 spec/groupdocs/storage/package_spec.rb
groupdocs-1.4.0 spec/groupdocs/storage/package_spec.rb
groupdocs-1.3.0 spec/groupdocs/storage/package_spec.rb