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 lib/merb-core/test/matchers/route_matchers.rb, line 86 def initialize(hash_or_object) @expected = {} case hash_or_object when Hash then @expected = hash_or_object else @expected[:id] = hash_or_object.to_param end end
The failure message. |
# File lib/merb-core/test/matchers/route_matchers.rb, line 108 def failure_message "expected the route to contain parameters #{@expected.inspect}, but instead contained #{@actual.inspect}" end
parameter_hash<Hash> |
The route parameters to match. |
Boolean |
True if the route parameters match the expected ones. |
# File lib/merb-core/test/matchers/route_matchers.rb, line 99 def matches?(parameter_hash) @actual = parameter_hash.dup.except(:controller, :action) return @actual.empty? if @expected.empty? @expected.all? {|(k, v)| @actual.has_key?(k) && @actual[k] == v} end
Generated with the Darkfish Rdoc Generator 2.