Sha256: 79ade2670db74eec5b04efe6336befb2350b37102a4ec3129b69562110234de0

Contents?: true

Size: 1.29 KB

Versions: 24

Compression:

Stored size: 1.29 KB

Contents

shared_examples_for GroupDocs::Api::Entity do
  before(:each) do
    # make sure necessary attribute exist
    described_class.class_eval('attr_accessor :id, :test')
    # stub required attributes
    case described_class.name
    when 'GroupDocs::Document'
      described_class.any_instance.stub(file: GroupDocs::Storage::File.new)
    when 'GroupDocs::Document::Annotation'
      GroupDocs::Document.any_instance.stub(file: GroupDocs::Storage::File.new)
      described_class.any_instance.stub(document: GroupDocs::Document.new)
    when 'GroupDocs::Document::Annotation::Reply'
      GroupDocs::Document.any_instance.stub(file: GroupDocs::Storage::File.new)
      GroupDocs::Document::Annotation.any_instance.stub(document: GroupDocs::Document.new)
      described_class.any_instance.stub(annotation: GroupDocs::Document::Annotation.new)
    end
  end

  it { should be_a(GroupDocs::Api::Entity) }

  describe '#initialize' do
    it 'allows passing options' do
      object = described_class.new(id: 1, test: 'Test')
      object.id.should == 1
      object.test.should == 'Test'
    end

    it 'calls passed block for self' do
      object = described_class.new do |object|
        object.id = 1
        object.test = 'Test'
      end
      object.id.should == 1
      object.test.should == 'Test'
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
groupdocs-1.1.0 spec/support/shared_examples/api/entity.rb
groupdocs-1.0.0 spec/support/shared_examples/api/entity.rb
groupdocs-0.3.11 spec/support/shared_examples/api/entity.rb
groupdocs-0.3.10 spec/support/shared_examples/api/entity.rb
groupdocs-0.3.9 spec/support/shared_examples/api/entity.rb
groupdocs-0.3.8 spec/support/shared_examples/api/entity.rb
groupdocs-0.3.7 spec/support/shared_examples/api/entity.rb
groupdocs-0.3.6 spec/support/shared_examples/api/entity.rb
groupdocs-0.3.5 spec/support/shared_examples/api/entity.rb
groupdocs-0.3.0 spec/support/shared_examples/api/entity.rb
groupdocs-0.2.11 spec/support/shared_examples/api/entity.rb
groupdocs-0.2.10 spec/support/shared_examples/api/entity.rb
groupdocs-0.2.9 spec/support/shared_examples/api/entity.rb
groupdocs-0.2.8 spec/support/shared_examples/api/entity.rb
groupdocs-0.2.7 spec/support/shared_examples/api/entity.rb
groupdocs-0.2.6 spec/support/shared_examples/api/entity.rb
groupdocs-0.2.5 spec/support/shared_examples/api/entity.rb
groupdocs-0.2.4 spec/support/shared_examples/api/entity.rb
groupdocs-0.2.3 spec/support/shared_examples/api/entity.rb
groupdocs-0.2.2 spec/support/shared_examples/api/entity.rb