class RSpec::Hal::Matchers::UriTemplateHasVariablesMatcher
Attributes
actual_tmpl[R]
expected_vars[R]
tmpl_matcher[R]
Public Class Methods
new(vars)
click to toggle source
# File lib/rspec/hal/matchers/uri_template_has_variables_matcher.rb, line 8 def initialize(vars) @expected_vars = Set.new(vars.map(&:to_s)) end
Public Instance Methods
description()
click to toggle source
# File lib/rspec/hal/matchers/uri_template_has_variables_matcher.rb, line 19 def description "have variables #{as_human_list(expected_vars)}" end
failure_message()
click to toggle source
# File lib/rspec/hal/matchers/uri_template_has_variables_matcher.rb, line 23 def failure_message "Expected #{actual_tmpl.pattern} to have #{as_human_list(expected_vars)}" end
failure_message_when_negated()
click to toggle source
# File lib/rspec/hal/matchers/uri_template_has_variables_matcher.rb, line 27 def failure_message_when_negated "Expected #{actual_tmpl.pattern} not to have #{as_human_list(expected_vars)}" end
matches?(actual)
click to toggle source
# File lib/rspec/hal/matchers/uri_template_has_variables_matcher.rb, line 12 def matches?(actual) self.actual_tmpl = actual expected_vars.subset? actual_vars end
Also aliased as: ===
Protected Instance Methods
actual_tmpl=(a_template)
click to toggle source
# File lib/rspec/hal/matchers/uri_template_has_variables_matcher.rb, line 35 def actual_tmpl=(a_template) @actual_tmpl = if a_template.respond_to? :pattern actual_tmpl else Addressable::Template.new(a_template) end end
actual_vars()
click to toggle source
# File lib/rspec/hal/matchers/uri_template_has_variables_matcher.rb, line 43 def actual_vars Set.new(actual_tmpl.variables) end
as_human_list(enum)
click to toggle source
# File lib/rspec/hal/matchers/uri_template_has_variables_matcher.rb, line 47 def as_human_list(enum) enum.to_a.join(", ") end