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
15 changes: 14 additions & 1 deletion features/animal.feature
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
#Create your feature here
Feature: Animal
Scenario: Old Cat
Given a "cat" named "Bob" that is 5 years old
Then it should be named "Bob"
And it should be a "cat"
And it should be 5 years old
And it should be considered old

Scenario: Yound Dog
Given a "dog" named "Winny" that is 2 years old
Then it should be named "Winny"
And it should be a "dog"
And it should be 2 years old
And it should not be considered old
24 changes: 23 additions & 1 deletion features/step_definitions/animal_steps.rb
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
#Delete this comment, here is where you should write your step defs
Given(/^a "(.*?)" named "(.*?)" that is (\d+) years old$/) do |type, name, age|
@animal = Animal.new(name, type, age.to_i)
end

Then(/^it should be named "(.*?)"$/) do |name|
expect(@animal.name).to eq name
end

Then(/^it should be a "(.*?)"$/) do |type|
expect(@animal.type).to eq type
end

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

Then(/^it should be considered old$/) do
expect(@animal.old?).to be_truthy
end

Then(/^it should not be considered old$/) do
expect(@animal.old?).to be_falsey
end