diff --git a/lib/database_cleaner/spec/shared_examples.rb b/lib/database_cleaner/spec/shared_examples.rb index 18e28bdd..aef57513 100644 --- a/lib/database_cleaner/spec/shared_examples.rb +++ b/lib/database_cleaner/spec/shared_examples.rb @@ -1,14 +1,6 @@ -RSpec.shared_examples_for "a generic strategy" do +RSpec.shared_examples_for "a database_cleaner strategy" do it { is_expected.to respond_to(:db) } -end - -RSpec.shared_examples_for "a generic truncation strategy" do - it { is_expected.to respond_to(:start) } - it { is_expected.to respond_to(:clean) } - it { is_expected.to respond_to(:cleaning) } -end - -RSpec.shared_examples_for "a generic transaction strategy" do + it { is_expected.to respond_to(:db=) } it { is_expected.to respond_to(:start) } it { is_expected.to respond_to(:clean) } it { is_expected.to respond_to(:cleaning) } @@ -21,4 +13,12 @@ it 'default_strategy should be part of available_strategies' do expect(described_class.available_strategies).to include(described_class.default_strategy) end + + describe 'all strategies should adhere to a database_cleaner strategy interface' do + described_class.available_strategies.each do |strategy| + subject { described_class.const_get(strategy.to_s.capitalize).new } + + it_behaves_like 'a database_cleaner strategy' + end + end end