Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion features/animal.feature
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
#Create your feature here
Feature: Animal
As a hotel attendant
I need to have information about animals

Scenario Outline: Animals
Given a <type> that is <age>, named "<name>"
Then the animal is <old>
And the animal should have a name, age, and type

Examples:
| name | type | age | old |
| King | dog | 5 | old |
| Prince | hamster | 2 | not old |
| Vinnie | rabbit | 3 | not old |
| Fluffy | cat | 4 | old |

19 changes: 18 additions & 1 deletion features/step_definitions/animal_steps.rb
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
#Delete this comment, here is where you should write your step defs
Given /^an? (\w+) that is (\w+), named "(\w+)"$/ do |type, age, name|
@name = name
@type = type
@age = age.to_i
@animal = Animal.new(name, type, @age)
end

Then /^the animal is (old|not old)$/ do |old_label|
is_old = old_label == 'old'
expect(@animal.old?).to eq is_old
end

Then /^the animal should have a name, age, and type$/ do
expect(@animal.name).to eq @name
expect(@animal.type).to eq @type
expect(@animal.age).to eq @age
end

2 changes: 1 addition & 1 deletion features/step_definitions/greeter_steps.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Given(/^a animal$/) do
Given(/^an? animal$/) do
@animal = Animal.new('Lucy', 'cat', 4)
end

Expand Down