Sha256: ad631159a855273d7376ff088b6a8f9312eaca24b001ee0bb40b04b7644a7e63

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Ripple::Document::Timestamps do
  require 'support/models/clock'
  
  before :each do
    response = {:headers => {"content-type" => ["application/json"]}, :body => "{}"}
    @client = Ripple.client
    @http = mock("HTTP Backend", :get => response, :put => response, :post => response, :delete => response)
    @client.stub!(:http).and_return(@http)
    @clock = Clock.new
  end
  
  it "should add a created_at property" do
    @clock.should respond_to(:created_at)
  end
  
  it "should add an updated_at property" do
    @clock.should respond_to(:updated_at)
  end
  
  it "should set the created_at timestamp when the object is initialized" do
    @clock.created_at.should_not be_nil
  end
  
  it "should not set the updated_at timestamp when the object is initialized" do
    @clock.updated_at.should be_nil
  end
  
  it "should set the updated_at timestamp when the object is created" do
    @clock.save
    @clock.updated_at.should_not be_nil
  end
  
  it "should update the updated_at timestamp when the object is updated" do
    @clock.save
    start = @clock.updated_at
    @clock.save
    @clock.updated_at.should > start
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ripple-0.7.0 spec/ripple/timestamps_spec.rb