Sha256: 8a6cefade44aa79ba05f008b1a820c0e252dc6fb6032e42c610cbe57164be8fc

Contents?: true

Size: 647 Bytes

Versions: 2

Compression:

Stored size: 647 Bytes

Contents

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

describe Date, 'to_json' do
  it "should format the date in a way that i can use it for sorting in couchdb" do
    date = Date.parse('2009-01-01')
    date.to_json.should == "\"2009/01/01\""
  end
end

describe Date, 'to_s(:json)' do
  it "should format it in the same way as to_json does so i can use this to do queries over date attributes" do
    date = Date.parse('2009-01-01')
    date.to_s(:json).should == "2009/01/01"
  end
end

describe Date, 'to_s' do
  it "should leave the original to_s untouched" do
    date = Date.parse('2009-01-01')
    date.to_s.should == "2009-01-01"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
couch_potato-0.2.27 spec/unit/date_spec.rb
couch_potato-0.2.26 spec/unit/date_spec.rb