Skip to content

Commit

Permalink
RSpec - avoid monkey patching
Browse files Browse the repository at this point in the history
  - configure --only-failures feature
  • Loading branch information
olleolleolle authored and pitr-ch committed Feb 21, 2018
1 parent d3ce358 commit 01f5397
Show file tree
Hide file tree
Showing 87 changed files with 148 additions and 145 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -24,3 +24,5 @@ tmtags
# junk
.DS_Store
.githubtoken

spec/examples.txt
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -20,7 +20,7 @@ group :development do
end

group :testing do
gem 'rspec', '~> 3.3.0'
gem 'rspec', '~> 3.7'
gem 'timecop', '~> 0.7.4'
end

Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/actor_spec.rb
Expand Up @@ -6,7 +6,7 @@ module Actor

# FIXME better tests!

describe 'Concurrent::Actor', edge: true, if: !defined?(JRUBY_VERSION) do
RSpec.describe 'Concurrent::Actor', edge: true, if: !defined?(JRUBY_VERSION) do

def terminate_actors(*actors)
actors.each do |actor|
Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/agent_spec.rb
Expand Up @@ -2,7 +2,7 @@

module Concurrent

describe Agent do
RSpec.describe Agent do

let!(:immediate) { Concurrent::ImmediateExecutor.new }
let!(:executor) { Concurrent::SingleThreadExecutor.new }
Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/array_spec.rb
@@ -1,5 +1,5 @@
module Concurrent
describe Array do
RSpec.describe Array do
let!(:ary) { described_class.new }

it 'concurrency' do
Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/async_spec.rb
@@ -1,6 +1,6 @@
module Concurrent

describe Async do
RSpec.describe Async do

let(:async_class) do
Class.new do
Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/atom_spec.rb
Expand Up @@ -2,7 +2,7 @@

module Concurrent

describe Atom do
RSpec.describe Atom do

context 'construction' do

Expand Down
10 changes: 5 additions & 5 deletions spec/concurrent/atomic/atomic_boolean_spec.rb
@@ -1,4 +1,4 @@
shared_examples :atomic_boolean do
RSpec.shared_examples :atomic_boolean do

describe 'construction' do

Expand Down Expand Up @@ -104,7 +104,7 @@

module Concurrent

describe MutexAtomicBoolean do
RSpec.describe MutexAtomicBoolean do

it_should_behave_like :atomic_boolean

Expand Down Expand Up @@ -142,19 +142,19 @@ module Concurrent

if defined? Concurrent::CAtomicBoolean

describe CAtomicBoolean, ext: true do
RSpec.describe CAtomicBoolean, ext: true do
it_should_behave_like :atomic_boolean
end
end

if Concurrent.on_jruby?

describe JavaAtomicBoolean do
RSpec.describe JavaAtomicBoolean do
it_should_behave_like :atomic_boolean
end
end

describe AtomicBoolean do
RSpec.describe AtomicBoolean do
if RUBY_ENGINE != 'ruby'
it 'does not load the C extension' do
expect(defined?(Concurrent::CAtomicBoolean)).to be_falsey
Expand Down
10 changes: 5 additions & 5 deletions spec/concurrent/atomic/atomic_fixnum_spec.rb
@@ -1,4 +1,4 @@
shared_examples :atomic_fixnum do
RSpec.shared_examples :atomic_fixnum do

context 'construction' do

Expand Down Expand Up @@ -153,7 +153,7 @@

module Concurrent

describe MutexAtomicFixnum do
RSpec.describe MutexAtomicFixnum do

it_should_behave_like :atomic_fixnum

Expand Down Expand Up @@ -202,19 +202,19 @@ module Concurrent

if defined? Concurrent::CAtomicFixnum

describe CAtomicFixnum, ext: true do
RSpec.describe CAtomicFixnum, ext: true do
it_should_behave_like :atomic_fixnum
end
end

if Concurrent.on_jruby?

describe JavaAtomicFixnum do
RSpec.describe JavaAtomicFixnum do
it_should_behave_like :atomic_fixnum
end
end

describe AtomicFixnum do
RSpec.describe AtomicFixnum do
if RUBY_ENGINE != 'ruby'
it 'does not load the C extension' do
expect(defined?(Concurrent::CAtomicFixnum)).to be_falsey
Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/atomic/atomic_markable_reference_spec.rb
@@ -1,4 +1,4 @@
describe Concurrent::Edge::AtomicMarkableReference do
RSpec.describe Concurrent::Edge::AtomicMarkableReference do
subject { described_class.new 1000, true }

describe '.initialize' do
Expand Down
32 changes: 16 additions & 16 deletions spec/concurrent/atomic/atomic_reference_spec.rb
@@ -1,4 +1,4 @@
shared_examples :atomic_reference do
RSpec.shared_examples :atomic_reference do

specify :test_construct do
atomic = described_class.new
Expand Down Expand Up @@ -145,7 +145,7 @@

module Concurrent

describe AtomicReference do
RSpec.describe AtomicReference do
it_should_behave_like :atomic_reference

describe '#to_s and #inspect' do
Expand All @@ -157,25 +157,25 @@ module Concurrent
end
end

describe MutexAtomicReference do
RSpec.describe MutexAtomicReference do
it_should_behave_like :atomic_reference
end

if defined? Concurrent::CAtomicReference
describe CAtomicReference, ext: true do
RSpec.describe CAtomicReference, ext: true do
it_should_behave_like :atomic_reference
end
elsif defined? Concurrent::JavaAtomicReference
describe JavaAtomicReference do
RSpec.describe JavaAtomicReference do
it_should_behave_like :atomic_reference
end
elsif defined? Concurrent::RbxAtomicReference
describe RbxAtomicReference do
RSpec.describe RbxAtomicReference do
it_should_behave_like :atomic_reference
end
end

describe AtomicReference do
RSpec.describe AtomicReference do
if Concurrent.on_jruby?
it 'inherits from JavaAtomicReference' do
expect(AtomicReference.ancestors).to include(Concurrent::JavaAtomicReference)
Expand All @@ -195,40 +195,40 @@ module Concurrent
end
end

describe MutexAtomicReference do
RSpec.describe MutexAtomicReference do
it_should_behave_like :atomic_reference
end

if defined? Concurrent::CAtomicReference
describe CAtomicReference, ext: true do
RSpec.describe CAtomicReference, ext: true do
it_should_behave_like :atomic_reference
end
elsif defined? Concurrent::JavaAtomicReference
describe JavaAtomicReference do
RSpec.describe JavaAtomicReference do
it_should_behave_like :atomic_reference
end
elsif defined? Concurrent::RbxAtomicReference
describe RbxAtomicReference do
RSpec.describe RbxAtomicReference do
it_should_behave_like :atomic_reference
end
end

describe AtomicReference do
RSpec.describe AtomicReference do
if Concurrent.on_jruby?
it 'inherits from JavaAtomicReference' do
expect(AtomicReference.ancestors).to include(Concurrent::JavaAtomicReference)
expect(described_class.ancestors).to include(Concurrent::JavaAtomicReference)
end
elsif Concurrent.allow_c_extensions?
it 'inherits from CAtomicReference', ext: true do
expect(AtomicReference.ancestors).to include(Concurrent::CAtomicReference)
expect(described_class.ancestors).to include(Concurrent::CAtomicReference)
end
elsif Concurrent.on_rbx?
it 'inherits from RbxAtomicReference' do
expect(AtomicReference.ancestors).to include(Concurrent::RbxAtomicReference)
expect(described_class.ancestors).to include(Concurrent::RbxAtomicReference)
end
else
it 'inherits from MutexAtomicReference' do
expect(AtomicReference.ancestors).to include(Concurrent::MutexAtomicReference)
expect(described_class.ancestors).to include(Concurrent::MutexAtomicReference)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/concurrent/atomic/count_down_latch_spec.rb
@@ -1,4 +1,4 @@
shared_examples :count_down_latch do
RSpec.shared_examples :count_down_latch do

let(:latch) { described_class.new(3) }
let(:zero_count_latch) { described_class.new(0) }
Expand Down Expand Up @@ -88,7 +88,7 @@

module Concurrent

describe MutexCountDownLatch do
RSpec.describe MutexCountDownLatch do

it_should_behave_like :count_down_latch

Expand Down Expand Up @@ -150,13 +150,13 @@ def subject.simulate_spurious_wake_up

if Concurrent.on_jruby?

describe JavaCountDownLatch do
RSpec.describe JavaCountDownLatch do

it_should_behave_like :count_down_latch
end
end

describe CountDownLatch do
RSpec.describe CountDownLatch do
if Concurrent.on_jruby?
it 'inherits from JavaCountDownLatch' do
expect(CountDownLatch.ancestors).to include(JavaCountDownLatch)
Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/atomic/cyclic_barrier_spec.rb
@@ -1,6 +1,6 @@
module Concurrent

describe CyclicBarrier do
RSpec.describe CyclicBarrier do

let(:parties) { 3 }
let!(:barrier) { described_class.new(3) }
Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/atomic/event_spec.rb
@@ -1,6 +1,6 @@
module Concurrent

describe Event do
RSpec.describe Event do

subject{ Event.new }

Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/atomic/read_write_lock_spec.rb
@@ -1,6 +1,6 @@
module Concurrent

describe ReadWriteLock do
RSpec.describe ReadWriteLock do

context '#write_locked?' do

Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/atomic/reentrant_read_write_lock_spec.rb
Expand Up @@ -72,7 +72,7 @@ def failure_message

# *******************************************************

describe ReentrantReadWriteLock do
RSpec.describe ReentrantReadWriteLock do

let(:lock) { RRWL.new }

Expand Down
8 changes: 4 additions & 4 deletions spec/concurrent/atomic/semaphore_spec.rb
@@ -1,4 +1,4 @@
shared_examples :semaphore do
RSpec.shared_examples :semaphore do
let(:semaphore) { described_class.new(3) }

describe '#initialize' do
Expand Down Expand Up @@ -159,17 +159,17 @@
end

module Concurrent
describe MutexSemaphore do
RSpec.describe MutexSemaphore do
it_should_behave_like :semaphore
end

if Concurrent.on_jruby?
describe JavaSemaphore do
RSpec.describe JavaSemaphore do
it_should_behave_like :semaphore
end
end

describe Semaphore do
RSpec.describe Semaphore do
if Concurrent.on_jruby?
it 'inherits from JavaSemaphore' do
expect(Semaphore.ancestors).to include(JavaSemaphore)
Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/atomic/thread_local_var_spec.rb
Expand Up @@ -4,7 +4,7 @@ module Concurrent

require 'concurrent/atomic/thread_local_var'

describe ThreadLocalVar do
RSpec.describe ThreadLocalVar do

context '#initialize' do

Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/channel/buffer/base_shared.rb
@@ -1,4 +1,4 @@
shared_examples :channel_buffer do
RSpec.shared_examples :channel_buffer do

specify do
expect(subject).to respond_to(:blocking?)
Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/channel/buffer/base_spec.rb
Expand Up @@ -2,7 +2,7 @@

module Concurrent::Channel::Buffer

describe Base, edge: true do
RSpec.describe Base, edge: true do

subject { described_class.new }

Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/channel/buffer/buffered_shared.rb
@@ -1,6 +1,6 @@
require_relative 'base_shared'

shared_examples :channel_buffered_buffer do
RSpec.shared_examples :channel_buffered_buffer do

it_behaves_like :channel_buffer

Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/channel/buffer/buffered_spec.rb
Expand Up @@ -2,7 +2,7 @@

module Concurrent::Channel::Buffer

describe Buffered, edge: true do
RSpec.describe Buffered, edge: true do

let(:capacity) { 10 }
subject { described_class.new(capacity) }
Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/channel/buffer/dropping_spec.rb
Expand Up @@ -2,7 +2,7 @@

module Concurrent::Channel::Buffer

describe Dropping, edge: true do
RSpec.describe Dropping, edge: true do

subject { described_class.new(10) }

Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/channel/buffer/sliding_spec.rb
Expand Up @@ -2,7 +2,7 @@

module Concurrent::Channel::Buffer

describe Sliding, edge: true do
RSpec.describe Sliding, edge: true do

subject { described_class.new(10) }

Expand Down
2 changes: 1 addition & 1 deletion spec/concurrent/channel/buffer/ticker_spec.rb
Expand Up @@ -2,7 +2,7 @@

module Concurrent::Channel::Buffer

describe Ticker, edge: true do
RSpec.describe Ticker, edge: true do

let(:delay) { 0.1 }
subject { described_class.new(delay) }
Expand Down

0 comments on commit 01f5397

Please sign in to comment.