Sha256: 691f9161a53b065382032103c37e493baa09d0f96b3860974e1a5d6118dc5a55

Contents?: true

Size: 781 Bytes

Versions: 3

Compression:

Stored size: 781 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe Virginia::DocumentCache::Document do
  let(:subject) { Virginia::DocumentCache::Document }

  before :each do
    Timecop.freeze
    @document = subject.new 'fake_id', 'fake_content'
  end

  it 'should accurately represent my content' do
    expect(@document.body).to eq 'fake_content'
  end

  it 'should automatically set the created_at time' do
    expect(@document.created_at).to eq Time.now
  end

  it 'should default to an empty expiration time' do
    expect(@document.expires_at).to be_nil
  end

  it 'should automatically determine the expiration time' do
    # TODO: Use Timecop to make this test more precise
    doc = subject.new '1', 'foo', 'text/plain', 30
    expect(doc.expires_at).to eq Time.now + 30
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
virginia-0.5.2 spec/virginia/document_cache/document_spec.rb
virginia-0.5.1 spec/virginia/document_cache/document_spec.rb
virginia-0.5.0 spec/virginia/document_cache/document_spec.rb