ShouldI.Matchers.Context
Convenience macros for generating short test cases of common structure. These matchers work with the context.
Summary
should_assign_key(list1) | Exactly match a key in the context to a value |
should_have_key(key) | Check for existence of a key in the context returned by setup |
should_match_key(list1) | Pattern match against context[key] |
should_not_have_key(key) | Negative check for existence of a key in the context returned by setup |
Macros
Exactly match a key in the context to a value.
Examples
setup context do
assign context, key_from_context_returned_by_setup: "exact expected value"
end
should_assign_key key_from_context_returned_by_setup: "exact expected value"
Check for existence of a key in the context returned by setup.
Examples
should_have_key :must_be_present
Pattern match against context[key]
Examples
should_match_key context_key: {:ok, _}