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
Binary file added features/.DS_Store
Binary file not shown.
11 changes: 10 additions & 1 deletion features/animal.feature
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
#Create your feature here
Feature: Track animals
keep the track of name, type and age of every animal
Based on the age determine whether the animal is old or not

Scenario: An animal
Given Animal is a lion named Leo who is 5 years old
Then name of the animal is "Leo"
And its type is lion
And it is 5 years old
And the animal is old
22 changes: 21 additions & 1 deletion features/step_definitions/animal_steps.rb
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
#Delete this comment, here is where you should write your step defs

Given (/^Animal is a (.*?) named (.*?) who is (\d+) years old$/) do |type, name, age|
@animal = Animal.new(name, type, age.to_i)
end

Then(/^name of the animal is "(.*?)"$/) do |arg1|
#name of the animal is "Leo"
expect(@animal.name).to eq arg1
end

Then(/^its type is (.*?)$/) do |type|
expect(@animal.type).to eq type
end

Then(/^it is (\d+) years old$/) do |age|
expect(@animal.age).to eq age.to_i
end

Then(/^the animal is old$/) do
expect(@animal.old?).to be true
end