Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed ruby_version_is from Mutex specs.

  • Loading branch information...
commit 0b2090a4d529201a9121a3bc2e42d13f87845fe2 1 parent b21ad06
@brixen brixen authored
View
6 core/mutex/lock_spec.rb
@@ -1,8 +1,6 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../shared/mutex/lock', __FILE__)
-ruby_version_is "1.9" do
- describe "Mutex#lock" do
- it_behaves_like :mutex_lock, :lock
- end
+describe "Mutex#lock" do
+ it_behaves_like :mutex_lock, :lock
end
View
6 core/mutex/locked_spec.rb
@@ -1,8 +1,6 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../shared/mutex/locked', __FILE__)
-ruby_version_is "1.9" do
- describe "Mutex#locked?" do
- it_behaves_like :mutex_locked, :locked?
- end
+describe "Mutex#locked?" do
+ it_behaves_like :mutex_locked, :locked?
end
View
108 core/mutex/sleep_spec.rb
@@ -1,73 +1,71 @@
require File.expand_path('../../../spec_helper', __FILE__)
-ruby_version_is "1.9" do
- describe "Mutex#sleep" do
- describe "when not locked by the current thread" do
- it "raises a ThreadError" do
- m = Mutex.new
- lambda { m.sleep }.should raise_error(ThreadError)
- end
-
- it "raises an ArgumentError if passed a negative duration" do
- m = Mutex.new
- lambda { m.sleep -0.1 }.should raise_error(ArgumentError)
- lambda { m.sleep -1 }.should raise_error(ArgumentError)
- end
+describe "Mutex#sleep" do
+ describe "when not locked by the current thread" do
+ it "raises a ThreadError" do
+ m = Mutex.new
+ lambda { m.sleep }.should raise_error(ThreadError)
end
it "raises an ArgumentError if passed a negative duration" do
m = Mutex.new
- m.lock
lambda { m.sleep -0.1 }.should raise_error(ArgumentError)
lambda { m.sleep -1 }.should raise_error(ArgumentError)
end
+ end
- it "pauses execution for approximately the duration requested" do
- m = Mutex.new
- m.lock
- duration = 0.1
- start = Time.now
- m.sleep duration
- (Time.now - start).should be_close(duration, 0.1)
- end
+ it "raises an ArgumentError if passed a negative duration" do
+ m = Mutex.new
+ m.lock
+ lambda { m.sleep -0.1 }.should raise_error(ArgumentError)
+ lambda { m.sleep -1 }.should raise_error(ArgumentError)
+ end
- it "unlocks the mutex while sleeping" do
- m = Mutex.new
- locked = false
- th = Thread.new { m.lock; locked = true; m.sleep }
- Thread.pass until locked
- Thread.pass while th.status and th.status != "sleep"
- m.locked?.should be_false
- th.run
- th.join
- end
+ it "pauses execution for approximately the duration requested" do
+ m = Mutex.new
+ m.lock
+ duration = 0.1
+ start = Time.now
+ m.sleep duration
+ (Time.now - start).should be_close(duration, 0.1)
+ end
- it "relocks the mutex when woken" do
- m = Mutex.new
- m.lock
- m.sleep(0.01)
- m.locked?.should be_true
- end
+ it "unlocks the mutex while sleeping" do
+ m = Mutex.new
+ locked = false
+ th = Thread.new { m.lock; locked = true; m.sleep }
+ Thread.pass until locked
+ Thread.pass while th.status and th.status != "sleep"
+ m.locked?.should be_false
+ th.run
+ th.join
+ end
- it "relocks the mutex when woken by an exception being raised" do
- m = Mutex.new
- th = Thread.new do
- m.lock
- begin
- m.sleep
- rescue Exception
- m.locked?
- end
- end
- Thread.pass while th.status and th.status != "sleep"
- th.raise(Exception)
- th.value.should be_true
- end
+ it "relocks the mutex when woken" do
+ m = Mutex.new
+ m.lock
+ m.sleep(0.01)
+ m.locked?.should be_true
+ end
- it "returns the rounded number of seconds asleep" do
- m = Mutex.new
+ it "relocks the mutex when woken by an exception being raised" do
+ m = Mutex.new
+ th = Thread.new do
m.lock
- m.sleep(0.01).should be_kind_of(Integer)
+ begin
+ m.sleep
+ rescue Exception
+ m.locked?
+ end
end
+ Thread.pass while th.status and th.status != "sleep"
+ th.raise(Exception)
+ th.value.should be_true
+ end
+
+ it "returns the rounded number of seconds asleep" do
+ m = Mutex.new
+ m.lock
+ m.sleep(0.01).should be_kind_of(Integer)
end
end
View
6 core/mutex/synchronize_spec.rb
@@ -1,8 +1,6 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../shared/mutex/synchronize', __FILE__)
-ruby_version_is "1.9" do
- describe "Mutex#synchronize" do
- it_behaves_like :mutex_synchronize, :synchronize
- end
+describe "Mutex#synchronize" do
+ it_behaves_like :mutex_synchronize, :synchronize
end
View
6 core/mutex/try_lock_spec.rb
@@ -1,8 +1,6 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../shared/mutex/try_lock', __FILE__)
-ruby_version_is "1.9" do
- describe "Mutex#try_lock" do
- it_behaves_like :mutex_try_lock, :try_lock
- end
+describe "Mutex#try_lock" do
+ it_behaves_like :mutex_try_lock, :try_lock
end
View
6 core/mutex/unlock_spec.rb
@@ -1,8 +1,6 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../shared/mutex/unlock', __FILE__)
-ruby_version_is "1.9" do
- describe "Mutex#unlock" do
- it_behaves_like :mutex_unlock, :unlock
- end
+describe "Mutex#unlock" do
+ it_behaves_like :mutex_unlock, :unlock
end
Please sign in to comment.
Something went wrong with that request. Please try again.