Sha256: fc28fa76d49618215540d3c4c82cd9e4a56e42f5c919f26021b1d89044598a65

Contents?: true

Size: 993 Bytes

Versions: 22

Compression:

Stored size: 993 Bytes

Contents

require 'spec_helper'

describe GroupDocs::Document::View do

  it_behaves_like GroupDocs::Api::Entity

  it { should have_accessor(:document)  }
  it { should have_accessor(:short_url) }
  it { should have_accessor(:viewed_on) }

  describe '#document=' do
    it 'sets document if GroupDocs::Document object is passed' do
      document = GroupDocs::Document.new(:file => GroupDocs::Storage::File.new)
      subject.document = document
      subject.document.should == document
    end

    it 'creates new GroupDocs::Document object from passed hash' do
      subject.document = { :id => 1, :name => 'test.pdf' }
      document = subject.document
      document.should be_a(GroupDocs::Document)
      document.file.id.should == 1
      document.file.name.should == 'test.pdf'
    end
  end

  describe '#viewed_on' do
    it 'returns converted to Time object Unix timestamp' do
      subject.viewed_on = 1330450135000
      subject.viewed_on.should == Time.at(1330450135)
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

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