Module: RSpec::Hal::Matchers
- Includes:
- Document
- 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
Defined Under Namespace
Modules: Document, HalMatcherHelpers Classes: HavePropertyMatcher, RelationMatcher, TemplatedRelationMatcher
Instance Method Summary collapse
-
#have_property(*args) ⇒ Object
Signature.
-
#have_relation(*args) ⇒ Object
Signature.
-
#have_templated_relation(*args) ⇒ Object
Examples.
Methods included from Document
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
46 47 48 |
# File 'lib/rspec/hal/matchers.rb', line 46 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|))
33 34 35 |
# File 'lib/rspec/hal/matchers.rb', line 33 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}"))
17 18 19 |
# File 'lib/rspec/hal/matchers.rb', line 17 def have_templated_relation(*args) TemplatedRelationMatcher.new(*args) end |