-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This introduces the bug as well (see 2 latest commits)
- Loading branch information
1 parent
ceafda1
commit 139ecc2
Showing
2 changed files
with
21 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,11 @@ | ||
use cucumber::*; | ||
use sub_lib::Cat; | ||
|
||
pub mod steps; | ||
|
||
// `World` is your shared, likely mutable state. | ||
// Cucumber constructs it via `Default::default()` for each scenario. | ||
#[derive(Debug, Default, World)] | ||
pub struct AnimalWorld { | ||
pub(crate) cat: Cat, | ||
} | ||
|
||
// Steps are defined with `given`, `when` and `then` attributes. | ||
#[given("a hungry cat")] | ||
pub fn hungry_cat(world: &mut AnimalWorld) { | ||
world.cat.hungry = true; | ||
} | ||
|
||
#[when("I feed the cat")] | ||
pub fn feed_cat(world: &mut AnimalWorld) { | ||
world.cat.feed(); | ||
} | ||
|
||
#[then("the cat is not hungry")] | ||
pub fn cat_is_fed(world: &mut AnimalWorld) { | ||
assert!(!world.cat.hungry); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use cucumber::*; | ||
|
||
use super::AnimalWorld; | ||
|
||
// Steps are defined with `given`, `when` and `then` attributes. | ||
#[given("a hungry cat")] | ||
pub fn hungry_cat(world: &mut AnimalWorld) { | ||
world.cat.hungry = true; | ||
} | ||
|
||
#[when("I feed the cat")] | ||
pub fn feed_cat(world: &mut AnimalWorld) { | ||
world.cat.feed(); | ||
} | ||
|
||
#[then("the cat is not hungry")] | ||
pub fn cat_is_fed(world: &mut AnimalWorld) { | ||
assert!(!world.cat.hungry); | ||
} |