Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding feature and step defs files. #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
15 changes: 15 additions & 0 deletions 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 manager
I want to know the name, type, and age of all animals

Scenario Outline: animals checking into the hotel
Given a <type> named <name> that is <age> years old
When the <type> <verb> older than 3
Then the <type> <verb> old

Examples:
| name | type | age | verb |
| Proxy | dog | 2 | isn't |
| Rover | dog | 4 | is |
| Rex | lizard | 3 | isn't |
17 changes: 17 additions & 0 deletions 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(/^a (\w+) named (\w+) that is (\d+) years old$/) do |type, name, age|
@animal = Animal.new(name, type, age.to_i)
end

When(/^the (\w+) ([\w']+) older than (\d+)$/) do |type, verb, age|
is_old = (verb == "is")

expect(@animal.old?).to eq(is_old)
end

Then(/^the (\w+) ([\w']+) old$/) do |type, verb|
is_old = (verb == "is")

expect(@animal.type).to eq(type)
expect(@animal.old?).to eq(is_old)
end