diff --git a/features/animal.feature b/features/animal.feature index aa25af6..6d520ef 100644 --- a/features/animal.feature +++ b/features/animal.feature @@ -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 diff --git a/features/step_definitions/animal_steps.rb b/features/step_definitions/animal_steps.rb index 324ff13..df1cd45 100644 --- a/features/step_definitions/animal_steps.rb +++ b/features/step_definitions/animal_steps.rb @@ -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