couch_surfer 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,15 +15,6 @@ module CouchSurfer
15
15
  @database = db
16
16
  end
17
17
 
18
- # Adapted from ActiveSupport Time#formatted_offset
19
- def self.format_utc_offset(time)
20
- seconds_offset_from_utc = time.utc_offset
21
- sign = (seconds_offset_from_utc < 0 ? -1 : 1)
22
- hours = seconds_offset_from_utc.abs / 3600
23
- minutes = (seconds_offset_from_utc.abs % 3600) / 60
24
- "%+03d%02d" % [ hours * sign, minutes ]
25
- end
26
-
27
18
  module ClassMethods
28
19
  # override the CouchSurfer::Model-wide default_database
29
20
  def use_database db
@@ -164,9 +155,7 @@ module CouchSurfer
164
155
  end
165
156
  end
166
157
  before(:save) do
167
- time = Time.now
168
- utc_offset = CouchSurfer::Model.format_utc_offset(time)
169
- self['updated_at'] = time.strftime("%Y/%m/%d %H:%M:%S.#{time.usec} #{utc_offset}")
158
+ self['updated_at'] = Time.now
170
159
  self['created_at'] = self['updated_at'] if new_document?
171
160
  end
172
161
  end
@@ -544,6 +544,7 @@ describe CouchSurfer::Model do
544
544
  oldart.destroy if oldart
545
545
  @art = Article.new(:title => "Saving this")
546
546
  @art.save
547
+ @art.reload
547
548
  end
548
549
  it "should set the time on create" do
549
550
  (Time.now - @art.created_at).should < 2
@@ -553,7 +554,7 @@ describe CouchSurfer::Model do
553
554
  it "should set the time on update" do
554
555
  sleep 1 # HACK!! Sometimes takes less than a second to call save the second time. Really should mock this!
555
556
  @art.save
556
- @art.created_at.should < @art.updated_at
557
+ @art.reload.created_at.should < @art.updated_at
557
558
  end
558
559
 
559
560
  it "should return both created_at and updated_at as instances of Time" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couch_surfer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Groves
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-27 00:00:00 +01:00
12
+ date: 2010-02-12 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency