-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only obfuscate if the instance has the field in question.
- Loading branch information
Craig McNamara
committed
Dec 15, 2015
1 parent
f563d92
commit 08b94ed
Showing
2 changed files
with
17 additions
and
2 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
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 |
---|---|---|
|
@@ -88,6 +88,20 @@ | |
|
||
expect(inserts).to eq [ %q{INSERT INTO "chefs" ("id", "name", "email") VALUES (1, 'Netto', 'changeme')} ] | ||
end | ||
|
||
it 'only scrables instances with the obfuscate field defined' do | ||
Polo.configure do | ||
obfuscate :name, | ||
email: ->(e) { "#{e.split("@")[0]}[email protected]" }, | ||
title: ->(t) { t.chars.reverse!.join } | ||
end | ||
|
||
exp = Polo.explore(AR::Chef, 1, :recipes) | ||
|
||
explore_statement = exp.join(';') | ||
expect(explore_statement).to_not match('[email protected]') | ||
expect(explore_statement).to_not match('Netto') | ||
end | ||
end | ||
|
||
describe 'on_duplicate' do | ||
|