Skip to content

Commit 1ae93a0

Browse files
jdantonioalexdowad
authored andcommitted
Fixed buggy ReadWriteLock specs.
1 parent 6ebecb3 commit 1ae93a0

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

spec/concurrent/atomic/read_write_lock_spec.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,11 @@ module Concurrent
149149
}.to raise_error(Concurrent::ResourceLimitError)
150150
end
151151

152-
it 'does not release the lock when an exception is raised' do
153-
expect(subject).to_not receive(:release_read_lock).with(any_args)
154-
lambda do
155-
subject.with_read_lock { raise StandardError }
152+
it 'releases the lock when an exception is raised' do
153+
expect(subject).to receive(:release_read_lock).with(any_args)
154+
begin
155+
subject.release_read_lock { raise StandardError }
156+
rescue
156157
end
157158
end
158159
end
@@ -189,10 +190,11 @@ module Concurrent
189190
}.to raise_error(Concurrent::ResourceLimitError)
190191
end
191192

192-
it 'does not release the lock when an exception is raised' do
193-
expect(subject).to_not receive(:release_write_lock).with(any_args)
194-
lambda do
193+
it 'releases the lock when an exception is raised' do
194+
expect(subject).to receive(:release_write_lock).with(any_args)
195+
begin
195196
subject.with_write_lock { raise StandardError }
197+
rescue
196198
end
197199
end
198200
end

0 commit comments

Comments
 (0)