Class | Merb::Test::Rspec::RouteMatchers::ParameterMatcher |
In: |
merb-core/lib/merb-core/test/matchers/route_matchers.rb
|
Parent: | Object |
actual | [RW] | |
expected | [RW] |
hash_or_object<Hash, ~to_param>: | The parameters to match. |
If hash_or_object is an object, then a new expected hash will be constructed with the key :id set to hash_or_object.to_param.
# File merb-core/lib/merb-core/test/matchers/route_matchers.rb, line 86 86: def initialize(hash_or_object) 87: @expected = {} 88: case hash_or_object 89: when Hash then @expected = hash_or_object 90: else @expected[:id] = hash_or_object.to_param 91: end 92: end
parameter_hash<Hash>: | The route parameters to match. |
Boolean: | True if the route parameters match the expected ones. |
# File merb-core/lib/merb-core/test/matchers/route_matchers.rb, line 99 99: def matches?(parameter_hash) 100: @actual = parameter_hash.dup.except(:controller, :action) 101: 102: return @actual.empty? if @expected.empty? 103: @expected.all? {|(k, v)| @actual.has_key?(k) && @actual[k] == v} 104: end