-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #444 from anicholson/master
Make the NullStrategy API-complete
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,10 @@ def self.db=(connection) | |
def self.clean | ||
# no-op | ||
end | ||
|
||
def self.cleaning(&block) | ||
# no-op | ||
yield | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |