Sha256: 9e9871482ce0dc0e85029dd147bcda2d9c0dd5ca6f9353542c6e9ce23c96e42c
Contents?: true
Size: 710 Bytes
Versions: 12
Compression:
Stored size: 710 Bytes
Contents
require 'unit_spec_helper' describe Shoulda::Matchers::ActionController::FilterParamMatcher, type: :controller do it 'accepts filtering a filtered parameter' do filter(:secret) expect(nil).to filter_param(:secret) end it 'accepts filtering a parameter matching a filtered regex' do filter(/(?!tip)pin(?!g)/) expect(nil).to filter_param(:pin) end it 'rejects filtering an unfiltered parameter' do filter(:secret) matcher = filter_param(:other) expect(matcher.matches?(nil)).to eq false expect(matcher.failure_message).to match(/Expected other to be filtered.*secret/) end def filter(param) Rails.application.config.filter_parameters = [param] end end
Version data entries
12 entries across 12 versions & 2 rubygems