Commit af7a99c Jon Yurek
committed
1 parent a05fb27 commit af7a99c Copy full SHA for af7a99c
File tree 2 files changed +7
-6
lines changed
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ def content_type
187
187
# lives in the <attachment>_updated_at attribute of the model.
188
188
def updated_at
189
189
time = instance_read ( :updated_at )
190
- time && time . to_i
190
+ time && time . to_f . to_i
191
191
end
192
192
193
193
# Paths and URLs can have a number of variables interpolated into them
Original file line number Diff line number Diff line change @@ -531,9 +531,10 @@ def do_after_all; end
531
531
@attachment . stubs ( :instance_read ) . with ( :file_name ) . returns ( "5k.png" )
532
532
@attachment . stubs ( :instance_read ) . with ( :content_type ) . returns ( "image/png" )
533
533
@attachment . stubs ( :instance_read ) . with ( :file_size ) . returns ( 12345 )
534
- now = Time . now
535
- Time . stubs ( :now ) . returns ( now )
536
- @attachment . stubs ( :instance_read ) . with ( :updated_at ) . returns ( Time . now )
534
+ dtnow = DateTime . now
535
+ @now = Time . now
536
+ Time . stubs ( :now ) . returns ( @now )
537
+ @attachment . stubs ( :instance_read ) . with ( :updated_at ) . returns ( dtnow )
537
538
end
538
539
539
540
should "return a correct url even if the file does not exist" do
@@ -542,11 +543,11 @@ def do_after_all; end
542
543
end
543
544
544
545
should "make sure the updated_at mtime is in the url if it is defined" do
545
- assert_match %r{#{ Time . now . to_i } $} , @attachment . url ( :blah )
546
+ assert_match %r{#{ @ now. to_i } $} , @attachment . url ( :blah )
546
547
end
547
548
548
549
should "make sure the updated_at mtime is NOT in the url if false is passed to the url method" do
549
- assert_no_match %r{#{ Time . now . to_i } $} , @attachment . url ( :blah , false )
550
+ assert_no_match %r{#{ @ now. to_i } $} , @attachment . url ( :blah , false )
550
551
end
551
552
552
553
context "with the updated_at field removed" do
You can’t perform that action at this time.
0 commit comments