Skip to content

Expectations Examples

David edited this page Mar 21, 2015 · 1 revision

The best way to include examples on vigia is using register. Option disabled_if can be used to prevent the example for being executed on different situations. contexts limits the example to the listed contexts.

# On your config file, spec_helper, etc.
Vigia::Sail::Example.register(
  :my_custom_body_validator,
  expectation: -> { expect { MyValidator(result.body) }.not.to raise_error } },
  contexts:    [ :my_context ],  # default: :default
  disable_if:  -> { ! result.headers[:content_type].include?('my_validator_mime') }
  )
Clone this wiki locally