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

complete step defs and feature file for animal #26

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
16 changes: 15 additions & 1 deletion features/animal.feature
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
#Create your feature here
Feature: Animal
As a Classy Hotel worker
Given a client who is an animal
I want to track the name, type, age, and if the client is old

Scenario Outline: Animal Creation
Given a <animal_age> year old <animal_type> name <animal_name>
Then the animal is <old>
And the name, age, and type should match

Examples:
| animal_age | animal_type | animal_age | old |
| Harry | cat | 1 | not old |
| Winnie | dog | 1 | not old |
| Old Yeller | dog | 10 | old |
17 changes: 16 additions & 1 deletion features/step_definitions/animal_steps.rb
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
#Delete this comment, here is where you should write your step defs
Given 'a $animal_age year old $animal_type name $animal_name' do |_animal_age, _animal_type, _animal_name|
@age = _animal_age.to_i
@type = _animal_type
@name = _animal_name
@animal = Animal.new(_animal_name, _animal_type, _animal_age.to_i)
end

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

And 'the name, age, and type should match' do
expect(@animal.name).to be @name
expect(@animal.type).to be @type
expect(@animal.age).to be @age
end