Skip to main content

plugin_rule

Function plugin_rule 

Source
pub fn plugin_rule<S: Into<String>, P: Into<JsonPattern>>(
    name: S,
    example: P,
) -> PluginRule<JsonPattern>
Expand description

Match a value using a matching rule provided by a plugin. See PluginRule.

use pact_consumer::*;
use pact_consumer::prelude::plugin_rule;

// The `creditcard` rule, configured with the brand the number has to belong to
plugin_rule("creditcard", json_pattern!("4111111111111111")).with_value("brand", "visa");