-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
19 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
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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,29 @@ | |||
steps_for :knight do | |||
attr_accessor :knight | |||
|
|||
class Knight | |||
def initialize | |||
@hp = 20 | |||
end | |||
|
|||
def alive? | |||
@hp > 0 | |||
end | |||
|
|||
def attacked_for(amount) | |||
@hp -= amount | |||
end | |||
end | |||
|
|||
step "there is a knight" do | |||
self.knight = Knight.new | |||
end | |||
|
|||
step "the knight is alive" do | |||
knight.should be_alive | |||
end | |||
|
|||
step "the knight is dead" do | |||
knight.should_not be_alive | |||
end | |||
end |
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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,11 +1,16 @@ | |||
Feature: Tagged steps for and super | Feature: Red Dragons are deadly | ||
|
|||
@dragon | @dragon | ||
Scenario: | Scenario: | ||
Given there is a dragon | Given there is a dragon | ||
Then the dragon attacks for 10 hitpoints | And there is a knight | ||
When the dragon attacks the knight | |||
Then the knight is alive | |||
|
|
||
@red_dragon | @red_dragon | ||
Scenario: | Scenario: | ||
Given there is a dragon | Given there is a dragon | ||
And it is a fire breathing red dragon | And the dragon breathes fire | ||
Then the dragon attacks for 20 hitpoints | And there is a knight | ||
When the dragon attacks the knight | |||
Then the knight is dead |