Sha256: 0940c1c7801c7f36489159efcb459fc192d8dcd0c0cd6f7bd09e9cefa45b8b7c

Contents?: true

Size: 618 Bytes

Versions: 9

Compression:

Stored size: 618 Bytes

Contents

require '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

9 entries across 9 versions & 2 rubygems

Version Path
couch_potato-0.3.2 spec/unit/date_spec.rb
couch_potato-0.3.1 spec/unit/date_spec.rb
davber_couch_potato-0.3.0 spec/unit/date_spec.rb
couch_potato-0.3.0 spec/unit/date_spec.rb
couch_potato-0.2.32 spec/unit/date_spec.rb
couch_potato-0.2.31 spec/unit/date_spec.rb
couch_potato-0.2.30 spec/unit/date_spec.rb
couch_potato-0.2.29 spec/unit/date_spec.rb
couch_potato-0.2.28 spec/unit/date_spec.rb