Sha256: ad76e94f2767a4042b08dce404d560cdcd89f66be63a09d294f3a7f3e3ebb7c3

Contents?: true

Size: 1.45 KB

Versions: 22

Compression:

Stored size: 1.45 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)
    when 'GroupDocs::Questionnaire::Collector'
      described_class.any_instance.stub(:questionnaire => GroupDocs::Questionnaire.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

22 entries across 22 versions & 1 rubygems

Version Path
groupdocs-2.2.0 spec/support/shared_examples/api/entity.rb
groupdocs-2.1.0 spec/support/shared_examples/api/entity.rb
groupdocs-2.0.0 spec/support/shared_examples/api/entity.rb
groupdocs-1.9.0 spec/support/shared_examples/api/entity.rb
groupdocs-1.8.1 spec/support/shared_examples/api/entity.rb
groupdocs-1.8.0 spec/support/shared_examples/api/entity.rb
groupdocs-1.7.0 spec/support/shared_examples/api/entity.rb
groupdocs-1.6.0 spec/support/shared_examples/api/entity.rb
groupdocs-1.5.9 spec/support/shared_examples/api/entity.rb
groupdocs-1.5.8 spec/support/shared_examples/api/entity.rb
groupdocs-1.5.7 spec/support/shared_examples/api/entity.rb
groupdocs-1.5.6 spec/support/shared_examples/api/entity.rb
groupdocs-1.5.5 spec/support/shared_examples/api/entity.rb
groupdocs-1.5.4 spec/support/shared_examples/api/entity.rb
groupdocs-1.5.3 spec/support/shared_examples/api/entity.rb
groupdocs-1.5.2 spec/support/shared_examples/api/entity.rb
groupdocs-1.5.1 spec/support/shared_examples/api/entity.rb
groupdocs-1.5.0 spec/support/shared_examples/api/entity.rb
groupdocs-1.4.2 spec/support/shared_examples/api/entity.rb
groupdocs-1.4.1 spec/support/shared_examples/api/entity.rb