Sha256: 3589bd4e76d7e46c6982564b1f08766ba934fb2a8c49c731c4abb0f37806e385

Contents?: true

Size: 723 Bytes

Versions: 9

Compression:

Stored size: 723 Bytes

Contents

require 'spec_helper'

describe Time, 'to_json' do
  it "should convert to utc and format the time in a way that i can use it for sorting in couchdb" do
    time = Time.parse('2009-01-01 11:12:23 +0200')
    time.to_json.should == "\"2009/01/01 09:12:23 +0000\""
  end
end

describe Time, '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 time attributes" do
    time = Time.parse('2009-01-01 11:12:23 +0200')
    time.to_s(:json).should == "2009/01/01 09:12:23 +0000"
  end
end

describe Time, 'to_s' do
  it "should leave the original to_s untouched" do
    time = Time.parse('2009-01-01 10:12:23 +0100').getutc
    time.to_s.should include("09:12:23")
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

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