Sha256: 966cf40646ccdf4eb70121a8a4e61e3277f71589669b1f18c1e010b027903d9f
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
module Remarkable module ActionController module Matchers # Do not inherit from ActionController::Base since it don't need all macro stubs behavior. class FilterParamsMatcher < Remarkable::Base #:nodoc: arguments :collection => :params, :as => :param assertions :respond_to_filter_params? collection_assertions :is_filtered? protected def respond_to_filter_params? @subject.respond_to?(:filter_parameters) end def is_filtered? filtered = @subject.send(:filter_parameters, { @param.to_s => @param.to_s }) filtered[@param.to_s] == '[FILTERED]' end end # Checks if the controller filters the given params. # # == Examples # # should_filter_params :password # should_not_filter_params :username # # it { should filter_params(:password) } # it { should_not filter_params(:username) } # def filter_params(*params) FilterParamsMatcher.new(*params).spec(self) end alias :filter_param :filter_params end end end
Version data entries
2 entries across 2 versions & 1 rubygems