class Merb::Test::Rspec::RouteMatchers::ParameterMatcher
Attributes
actual[RW]
expected[RW]
Public Class Methods
new(hash_or_object)
click to toggle source
Parameters¶ ↑
- hash_or_object<Hash, ~to_param>
-
The parameters to match.
Alternatives¶ ↑
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
Public Instance Methods
failure_message()
click to toggle source
matches?(parameter_hash)
click to toggle source
Parameters¶ ↑
- parameter_hash<Hash>
-
The route parameters to match.
Returns¶ ↑
- 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
negative_failure_message()
click to toggle source