Skip to content

Commit

Permalink
Merge pull request #444 from anicholson/master
Browse files Browse the repository at this point in the history
Make the NullStrategy API-complete
  • Loading branch information
etagwerker committed May 23, 2016
2 parents f15d761 + 73dcfef commit f052d64
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/database_cleaner/null_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@ def self.db=(connection)
def self.clean
# no-op
end

def self.cleaning(&block)
# no-op
yield
end
end
end
28 changes: 28 additions & 0 deletions spec/database_cleaner/null_strategy_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'spec_helper'

module DatabaseCleaner
describe NullStrategy do
it 'responds to .start' do
expect { NullStrategy.start }.not_to raise_error(NoMethodError)
end

it 'responds to .clean' do
expect { NullStrategy.clean }.not_to raise_error(NoMethodError)
end

describe '.cleaning' do
it 'fails without a block' do
expect { NullStrategy.cleaning }.to raise_error(LocalJumpError)
end

it 'no-ops with a block' do
effect = double
expect(effect).to receive(:occur).once

NullStrategy.cleaning do
effect.occur
end
end
end
end
end

0 comments on commit f052d64

Please sign in to comment.