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
12 changes: 11 additions & 1 deletion features/animal.feature
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#Create your feature here
Feature: Animal
In order to properly track my hotel's clientele
As a hotel manager
I want to be able to verify their names, types, ages, and whether they are old

Scenario: Chinchilla
Given a chinchilla named Spike who is 4 years old
Then its type should be chinchilla
And its name should be Spike
And its age should be 4
And it should be old
20 changes: 19 additions & 1 deletion features/step_definitions/animal_steps.rb
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
#Delete this comment, here is where you should write your step defs
Given(/^a (.*?) named (.*?) who is (\d+) years old$/) do |type, name, age|
@animal = Animal.new(name, type, age.to_i)
end

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

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

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

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