the_force 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/the_force/keep_trying.rb +8 -4
- data/lib/the_force/ruby_version.rb +4 -0
- data/lib/the_force.rb +1 -0
- data/test/unit/test_keep_trying.rb +4 -0
- data/test/unit/test_rails_support.rb +1 -1
- data/test/unit/test_ruby_version.rb +4 -0
- metadata +2 -2
data/Rakefile
CHANGED
@@ -1,12 +1,16 @@
|
|
1
|
-
|
1
|
+
require 'the_force/ruby_version'
|
2
2
|
|
3
3
|
begin
|
4
|
-
require 'system_timer'
|
4
|
+
require 'system_timer' if TheForce.ruby_version.is18?
|
5
|
+
rescue LoadError => e
|
6
|
+
puts "WARNING - SystemTimer gem not found...reverting to Timeout::timeout"
|
7
|
+
end
|
8
|
+
|
9
|
+
if defined? SystemTimer and TheForce.ruby_version.is18?
|
5
10
|
def TheForce.timeout(*args, &b)
|
6
11
|
SystemTimer.timeout_after(*args, &b)
|
7
12
|
end
|
8
|
-
|
9
|
-
puts "WARNING - SystemTimer gem not found...reverting to Timeout::timeout"
|
13
|
+
else
|
10
14
|
require 'timeout'
|
11
15
|
def TheForce.timeout(*args, &b)
|
12
16
|
Timeout.timeout(*args, &b)
|
data/lib/the_force.rb
CHANGED
@@ -44,6 +44,10 @@ class TestKeepTrying < Test::Unit::TestCase
|
|
44
44
|
|
45
45
|
#def test_works_without_systemtimer
|
46
46
|
#def test_works_with_systemtimer
|
47
|
+
|
48
|
+
def test_systemtimer_is_not_loaded_in_19
|
49
|
+
assert false, "PENDING"
|
50
|
+
end
|
47
51
|
end
|
48
52
|
|
49
53
|
class TestKeepTryingSpecialError < StandardError
|
@@ -27,6 +27,10 @@ class TestRubyVersion < Test::Unit::TestCase
|
|
27
27
|
def test_is19?
|
28
28
|
assert_equal [@v.major, @v.minor] == [1,9], @v.is19?
|
29
29
|
end
|
30
|
+
|
31
|
+
def test_is18?
|
32
|
+
assert_equal [@v.major, @v.minor] == [1,8], @v.is18?
|
33
|
+
end
|
30
34
|
|
31
35
|
def test_is_frozen
|
32
36
|
assert @v.frozen?
|