Macro cucumber::When
[−]
[src]
macro_rules! When { ($cuke:expr, $regex:expr, $body:expr) => { ... }; }
Add a When step to a CucumberRegistrar
Example
#[macro_use] extern crate cucumber; use cucumber::{ CucumberRegistrar, Cucumber }; pub fn main () { let mut cucumber: Cucumber<u32> = Cucumber::new(); When!(cucumber, "^I spend (\\d+) coins$", |_, world: &mut u32, (coin_count,): (u32,)| { if *world - coin_count < 0 { panic!("Tried to spend more coins than were owned") } else { *world = *world - coin_count; } }); }Run