fake-resque 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.markdown +20 -2
- data/lib/fake-resque/base.rb +9 -0
- data/lib/fake-resque/resque.rb +12 -1
- data/lib/fake-resque/version.rb +1 -1
- metadata +2 -2
data/README.markdown
CHANGED
@@ -13,11 +13,23 @@ Usage
|
|
13
13
|
# That's it.
|
14
14
|
|
15
15
|
# To use the real Resque
|
16
|
-
|
16
|
+
|
17
17
|
FakeResque.deactivate!
|
18
18
|
|
19
19
|
# To disable the real Resque again
|
20
|
-
|
20
|
+
|
21
|
+
FakeResque.activate!
|
22
|
+
|
23
|
+
# To drop messages being sent through Resque
|
24
|
+
|
25
|
+
FakeResque.block!
|
26
|
+
|
27
|
+
# To start sending messages again
|
28
|
+
|
29
|
+
FakeResque.unblock!
|
30
|
+
|
31
|
+
# Or
|
32
|
+
|
21
33
|
FakeResque.activate!
|
22
34
|
|
23
35
|
Installation
|
@@ -38,6 +50,11 @@ Once you've made your great commits:
|
|
38
50
|
4. Create an [Issue][1] with a link to your branch
|
39
51
|
5. That's it!
|
40
52
|
|
53
|
+
Acknowledgements
|
54
|
+
----------------
|
55
|
+
|
56
|
+
Based on the [fakefs library][2] by defunkt.
|
57
|
+
|
41
58
|
Meta
|
42
59
|
----
|
43
60
|
|
@@ -48,3 +65,4 @@ Meta
|
|
48
65
|
|
49
66
|
[0]: http://help.github.com/forking/
|
50
67
|
[1]: http://github.com/jacobat/fake-resque/issues
|
68
|
+
[2]: http://github.com/defunkt/fakefs
|
data/lib/fake-resque/base.rb
CHANGED
@@ -6,6 +6,7 @@ module FakeResque
|
|
6
6
|
remove_const(:Resque)
|
7
7
|
const_set(:Resque, FakeResque::Resque)
|
8
8
|
end
|
9
|
+
unblock!
|
9
10
|
true
|
10
11
|
end
|
11
12
|
|
@@ -16,6 +17,14 @@ module FakeResque
|
|
16
17
|
end
|
17
18
|
true
|
18
19
|
end
|
20
|
+
|
21
|
+
def self.block!
|
22
|
+
FakeResque::Resque.block!
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.unblock!
|
26
|
+
FakeResque::Resque.unblock!
|
27
|
+
end
|
19
28
|
end
|
20
29
|
|
21
30
|
def FakeResque
|
data/lib/fake-resque/resque.rb
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
module FakeResque
|
2
2
|
class Resque
|
3
3
|
class << self
|
4
|
+
@forward = true
|
4
5
|
def enqueue(klass, *args)
|
5
|
-
|
6
|
+
if @forward
|
7
|
+
klass.perform(*args)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def block!
|
12
|
+
@forward = false
|
13
|
+
end
|
14
|
+
|
15
|
+
def unblock!
|
16
|
+
@forward = true
|
6
17
|
end
|
7
18
|
end
|
8
19
|
end
|
data/lib/fake-resque/version.rb
CHANGED