Module: RSpec::Hal::Matchers
- Includes:
- DocumentMatchers
- Defined in:
- lib/rspec/hal/matchers.rb,
lib/rspec/hal/matchers/relation_matcher.rb,
lib/rspec/hal/matchers/hal_matcher_helpers.rb,
lib/rspec/hal/matchers/have_property_matcher.rb,
lib/rspec/hal/matchers/templated_relation_matcher.rb,
lib/rspec/hal/matchers/uri_template_has_variables_matcher.rb
Defined Under Namespace
Modules: DocumentMatchers, HalMatcherHelpers Classes: HavePropertyMatcher, RelationMatcher, TemplatedRelationMatcher, UriTemplateHasVariablesMatcher
Instance Method Summary collapse
-
#have_property(*args) ⇒ Object
Signature.
-
#have_relation(*args) ⇒ Object
Signature.
-
#have_templated_relation(*args) ⇒ Object
Examples.
-
#have_variables(*args) ⇒ Object
(also: #has_variable, #with_variables, #with_variable)
Signature.
Methods included from DocumentMatchers
Instance Method Details
#have_property(*args) ⇒ Object
Signature
expect(a_doc).to have_property "name"
expect(a_doc).to have_property "name, matching(/alice/i)
expect(a_doc).to have_property("name").matching(/alice/i)
expect(a_doc).to have_property("hobbies").including(matching("golf"))
expect(a_doc).to have_property("name").that_is("Bob")
expect(a_doc).to have_property("age").that_is kind_of Numeric
47 48 49 |
# File 'lib/rspec/hal/matchers.rb', line 47 def have_property(*args) HavePropertyMatcher.new(*args) end |
#have_relation(*args) ⇒ Object
Signature
expect(doc).to have_relation(link_rel)
expect(doc).to have_relation(link_rel, href_matcher)
expect(doc).to have_relation(link_rel, template_variables)
expect(doc).to have_relation(link_rel, template_variables, href_matcher)
Examples
expect().to have_relation("search",
{q: "Alice"},
match(%r|users/42|))
34 35 36 |
# File 'lib/rspec/hal/matchers.rb', line 34 def have_relation(*args) RelationMatcher.new(*args) end |
#have_templated_relation(*args) ⇒ Object
Examples
expect(doc).to have_templated_relation("search")
expect(doc).to have_templated_relation("search", matching("{?q}"))
18 19 20 |
# File 'lib/rspec/hal/matchers.rb', line 18 def have_templated_relation(*args) TemplatedRelationMatcher.new(*args) end |
#have_variables(*args) ⇒ Object Also known as: has_variable, with_variables, with_variable
Signature
expect(a_uri_template_str).to have_variables "q", "limit"
expect(a_uri_template_str).to has_variable "q"
55 56 57 |
# File 'lib/rspec/hal/matchers.rb', line 55 def have_variables(*args) UriTemplateHasVariablesMatcher.new(*args) end |