expirable_locking 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -3,6 +3,8 @@
3
3
  Usage:
4
4
  Provides expirable locking for concurrent processing.
5
5
 
6
+ script/generate migration add_expirable_locking_to_my_model locked_at:datetime
7
+
6
8
  class MyModel < ActiveRecord::Base
7
9
  extend ExpirableLocking
8
10
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -9,7 +9,7 @@ module ExpirableLocking
9
9
 
10
10
  module InstanceMethods
11
11
 
12
- def lock_with_expirey
12
+ def lock_with_expiry
13
13
  self.class.lock(self)
14
14
  end
15
15
 
@@ -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.lock_with_expirey
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.lock_with_expirey
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.lock_with_expirey
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.lock_with_expirey
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.lock_with_expirey
73
+ @record.lock_with_expiry
74
74
  end
75
- @model.find(@record).lock_with_expirey # Oh hi, other process
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
- - 1
8
+ - 2
8
9
  - 0
9
- version: 0.1.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-07-26 00:00:00 -07:00
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.6
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.