Timestamps for sub-directories also have milliseconds resolution (refs #17)

This commit is contained in:
galfert 2012-10-24 06:09:28 +02:00
parent b8138a29f1
commit d1acfe88e8
2 changed files with 5 additions and 6 deletions

View File

@ -137,7 +137,6 @@ module RemoteStorage
sub_directories(user, directory).each do |entry| sub_directories(user, directory).each do |entry|
directory_name = CGI.unescape(entry["name"]).split("/").last directory_name = CGI.unescape(entry["name"]).split("/").last
timestamp = entry["timestamp"].to_i timestamp = entry["timestamp"].to_i
timestamp /= 1000 if timestamp.to_s.length == 13
listing.merge!({ "#{directory_name}/" => timestamp }) listing.merge!({ "#{directory_name}/" => timestamp })
end end

View File

@ -31,7 +31,7 @@ describe "Directories" do
content.must_include "http%3A%2F%2F5apps.com" content.must_include "http%3A%2F%2F5apps.com"
content.must_include "foo" content.must_include "foo"
content["foo"].must_be_kind_of Integer content["foo"].must_be_kind_of Integer
content["foo"].to_s.length.must_be :>=, 10 content["foo"].to_s.length.must_equal 13
end end
it "has a Last-Modifier header set" do it "has a Last-Modifier header set" do
@ -70,7 +70,7 @@ describe "Directories" do
content.must_include "http%3A%2F%2F5apps.com" content.must_include "http%3A%2F%2F5apps.com"
content.must_include "home/" content.must_include "home/"
content["home/"].must_be_kind_of Integer content["home/"].must_be_kind_of Integer
content["home/"].to_s.length.must_be :>=, 10 content["home/"].to_s.length.must_equal 13
end end
context "for a different user" do context "for a different user" do
@ -107,7 +107,7 @@ describe "Directories" do
content = JSON.parse(last_response.body) content = JSON.parse(last_response.body)
content.must_include "projects/" content.must_include "projects/"
content["projects/"].must_be_kind_of Integer content["projects/"].must_be_kind_of Integer
content["projects/"].to_s.length.must_be :>=, 10 content["projects/"].to_s.length.must_equal 13
end end
it "updates the timestamps of the existing directory objects" do it "updates the timestamps of the existing directory objects" do
@ -139,7 +139,7 @@ describe "Directories" do
content = JSON.parse(last_response.body) content = JSON.parse(last_response.body)
content.must_include "laundry" content.must_include "laundry"
content["laundry"].must_be_kind_of Integer content["laundry"].must_be_kind_of Integer
content["laundry"].to_s.length.must_be :>=, 10 content["laundry"].to_s.length.must_equal 13
end end
end end
@ -172,7 +172,7 @@ describe "Directories" do
content.must_include "root-2" content.must_include "root-2"
content.must_include "tasks/" content.must_include "tasks/"
content["tasks/"].must_be_kind_of Integer content["tasks/"].must_be_kind_of Integer
content["tasks/"].to_s.length.must_be :>=, 10 content["tasks/"].to_s.length.must_equal 13
end end
end end
end end