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

finished challenge #50

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
20 changes: 20 additions & 0 deletions features/animal.feature
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
#Create your feature here
#The hotel manager wants the script to keep track of the name, type and age of every animal
#Test the Animal object and ensure that it has the right output for its reader methods name,
#type, age, old?

Feature: Animal
I want my animal variables to be accessible

Scenario: Old Dog
Given an Animal
Then I check it is a "dog"
And I verify it has an "age"
And I see if it has a "name"
And I see if it is old

Scenario: Young Fish
Given an Animal
Then I check it is a "fish"
And I verify it has an "age"
And I see if it has a "name"
And I see if it is old
25 changes: 24 additions & 1 deletion features/step_definitions/animal_steps.rb
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
#Delete this comment, here is where you should write your step defs
Given(/^an Animal$/) do
@animal = Animal.new('Lucy', 'dog', 4)
@animal1 = Animal.new('Robert', 'fish', 2)
end

Then(/^I check it is a "(.*?)"$/) do |arg1|
expect(@animal.type).to eq "dog"
expect(@animal1.type).to eq "fish"
end

Then(/^I verify it has an "(.*?)"$/) do |arg1|
expect(@animal.age).to eq 4
expect(@animal1.age).to eq 2
end

Then(/^I see if it has a "(.*?)"$/) do |arg1|
expect(@animal.name).to eq "Lucy"
expect(@animal1.name).to eq "Robert"
end

Then(/^I see if it is old$/) do
expect(@animal.old?).to eq true
expect(@animal1.old?).to eq false
end