expirable_locking 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -0
- data/VERSION +1 -1
- data/lib/expirable_locking.rb +1 -1
- data/test/expirable_locking_test.rb +6 -6
- metadata +9 -4
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/expirable_locking.rb
CHANGED
@@ -43,12 +43,12 @@ class ExpirableLockingTest < ActiveRecord::TestCase
|
|
43
43
|
|
44
44
|
should "fail for locked records" do
|
45
45
|
@model.touch_lock(@record)
|
46
|
-
assert_equal false, @record.
|
46
|
+
assert_equal false, @record.lock_with_expiry
|
47
47
|
end
|
48
48
|
|
49
49
|
should "succeed for unlocked records" do
|
50
50
|
assert @model.unlocked.include?(@record)
|
51
|
-
assert_equal true, @record.
|
51
|
+
assert_equal true, @record.lock_with_expiry
|
52
52
|
end
|
53
53
|
|
54
54
|
end
|
@@ -56,7 +56,7 @@ class ExpirableLockingTest < ActiveRecord::TestCase
|
|
56
56
|
context "unlocking" do
|
57
57
|
|
58
58
|
should "succeed without querying the database for deleted records" do
|
59
|
-
@record.
|
59
|
+
@record.lock_with_expiry
|
60
60
|
@record.destroy
|
61
61
|
|
62
62
|
@record.class.connection.expects(:update).never
|
@@ -64,15 +64,15 @@ class ExpirableLockingTest < ActiveRecord::TestCase
|
|
64
64
|
end
|
65
65
|
|
66
66
|
should "succeed when the lock hasn't expired" do
|
67
|
-
@record.
|
67
|
+
@record.lock_with_expiry
|
68
68
|
assert_equal true, @record.unlock
|
69
69
|
end
|
70
70
|
|
71
71
|
should "fail when the lock expired and was re-aqcuired by another process" do
|
72
72
|
Timecop.freeze(@model.lock_duration.ago - 1.second) do
|
73
|
-
@record.
|
73
|
+
@record.lock_with_expiry
|
74
74
|
end
|
75
|
-
@model.find(@record).
|
75
|
+
@model.find(@record).lock_with_expiry # Oh hi, other process
|
76
76
|
|
77
77
|
assert_equal false, @record.unlock
|
78
78
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expirable_locking
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
+
- 2
|
8
9
|
- 0
|
9
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Eric Chapweske
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-08-24 00:00:00 -07:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -47,23 +48,27 @@ rdoc_options:
|
|
47
48
|
require_paths:
|
48
49
|
- lib
|
49
50
|
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
50
52
|
requirements:
|
51
53
|
- - ">="
|
52
54
|
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
53
56
|
segments:
|
54
57
|
- 0
|
55
58
|
version: "0"
|
56
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
57
61
|
requirements:
|
58
62
|
- - ">="
|
59
63
|
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
60
65
|
segments:
|
61
66
|
- 0
|
62
67
|
version: "0"
|
63
68
|
requirements: []
|
64
69
|
|
65
70
|
rubyforge_project:
|
66
|
-
rubygems_version: 1.3.
|
71
|
+
rubygems_version: 1.3.7
|
67
72
|
signing_key:
|
68
73
|
specification_version: 3
|
69
74
|
summary: A tiny ActiveRecord extension for expirable locking.
|