Sha256: e3149d365370b7b95d872561143c2f402cdd15fa09e7da5e6aaf674fee44faec

Contents?: true

Size: 881 Bytes

Versions: 5

Compression:

Stored size: 881 Bytes

Contents

require 'spec_helper'

describe Array do
  
  class SimpleElement
    attr_accessor :updated_at, :published_at
    def initialize
      @updated_at = @published_at = Time.now
    end
  end

  it "should use the most recent date as updated one" do
    first = SimpleElement.new
    second = SimpleElement.new
    
    [first, second].updated_at.should == second.updated_at
    [first, first].updated_at.should == first.updated_at
    
    now = Time.now
    Time.should_receive(:now).and_return(now)
    [].updated_at.should == now
  end
  
  it "should return the oldest published date" do
    first = SimpleElement.new
    second = SimpleElement.new

    [first, second].published_at.should == first.published_at
    [first, first].published_at.should == first.published_at
    
    now = 545
    Time.should_receive(:now).and_return(now)
    [].updated_at.should == now
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 spec/unit/server/core_ext/array_spec.rb
restfulie-1.1.1 spec/unit/server/core_ext/array_spec.rb
restfulie-1.1.0 spec/unit/server/core_ext/array_spec.rb
restfulie-nosqlite-1.0.3 spec/unit/server/core_ext/array_spec.rb
restfulie-1.0.3 spec/unit/server/core_ext/array_spec.rb