adrian 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/adrian/directory_queue.rb +1 -1
- data/lib/adrian/file_item.rb +7 -1
- data/lib/adrian/version.rb +1 -1
- data/test/directory_queue_test.rb +2 -2
- data/test/file_item_test.rb +3 -3
- metadata +1 -1
data/lib/adrian/file_item.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
module Adrian
|
2
2
|
class FileItem < QueueItem
|
3
3
|
|
4
|
+
def initialize(value, created_at = Time.now)
|
5
|
+
@value = value
|
6
|
+
@created_at = created_at
|
7
|
+
updated_at
|
8
|
+
end
|
9
|
+
|
4
10
|
def path
|
5
11
|
value
|
6
12
|
end
|
@@ -27,7 +33,7 @@ module Adrian
|
|
27
33
|
end
|
28
34
|
|
29
35
|
def touch(updated_at = Time.new)
|
30
|
-
@updated_at =
|
36
|
+
@updated_at = updated_at
|
31
37
|
File.utime(updated_at, updated_at, path)
|
32
38
|
end
|
33
39
|
|
data/lib/adrian/version.rb
CHANGED
@@ -5,7 +5,7 @@ require 'fileutils'
|
|
5
5
|
|
6
6
|
describe Adrian::DirectoryQueue do
|
7
7
|
before do
|
8
|
-
@q = Adrian::DirectoryQueue.create(:path => Dir.mktmpdir('dir_queue_test'))
|
8
|
+
@q = Adrian::DirectoryQueue.create(:path => Dir.mktmpdir('dir_queue_test'), :delay => 0)
|
9
9
|
end
|
10
10
|
|
11
11
|
after do
|
@@ -68,7 +68,7 @@ describe Adrian::DirectoryQueue do
|
|
68
68
|
|
69
69
|
it 'touches the item' do
|
70
70
|
@q.push(@item)
|
71
|
-
now = Time.new
|
71
|
+
now = Time.new + 100
|
72
72
|
item = nil
|
73
73
|
Time.stub(:new, now) { item = @q.pop }
|
74
74
|
|
data/test/file_item_test.rb
CHANGED
@@ -28,9 +28,9 @@ describe Adrian::FileItem do
|
|
28
28
|
describe 'updated_at' do
|
29
29
|
|
30
30
|
it 'is nil when moved by another process' do
|
31
|
-
|
32
|
-
assert_equal false,
|
33
|
-
assert_equal nil,
|
31
|
+
item = Adrian::FileItem.new('moved/during/initialize')
|
32
|
+
assert_equal false, item.exist?
|
33
|
+
assert_equal nil, item.updated_at
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'is cached' do
|