Add basic test to verify the positive context of filtering params

This commit is contained in:
Russell Osborne 2017-06-01 20:54:17 -04:00
parent b59f640b19
commit 90815302ea
1 changed files with 16 additions and 0 deletions

View File

@ -71,4 +71,20 @@ describe ArticlesController do
Impression.last.session_hash.size.should eq 32 Impression.last.session_hash.size.should eq 32
Impression.last.referrer.should eq nil Impression.last.referrer.should eq nil
end end
describe "when filtering params" do
before do
@_filtered_params = Rails.application.config.filter_parameters
Rails.application.config.filter_parameters = [:password]
end
it "should FILTER params that are included in filtering {}" do
get "index", password: "best-password-ever"
Impression.last.params.should eq("password" => "[FILTERED]")
end
after do
Rails.application.config.filter_parameters = @_filtered_params
end
end
end end