diff --git a/features/animal.feature b/features/animal.feature index aa25af6..eac9600 100644 --- a/features/animal.feature +++ b/features/animal.feature @@ -1 +1,10 @@ -#Create your feature here +Feature: Animal + As a cat, I should have a name, type, and age + As a cat under 3 years old + I am not old + + Scenario: Cat + Given an animal + Then it has a name 'Elsa' + And it has an age of 2 + And it is not old diff --git a/features/step_definitions/animal_steps.rb b/features/step_definitions/animal_steps.rb index 324ff13..6ca21ac 100644 --- a/features/step_definitions/animal_steps.rb +++ b/features/step_definitions/animal_steps.rb @@ -1 +1,15 @@ -#Delete this comment, here is where you should write your step defs +Given(/^an animal$/) do + @animal = Animal.new('Elsa', 'cat', 2) +end + +Then(/^it has a name 'Elsa'$/) do + expect(@animal.name).to eq('Elsa') +end + +Then(/^it has an age of (\d+)$/) do |arg1| + expect(@animal.age).to eq(2) +end + +Then(/^it is not old$/) do + expect(@animal.old?).to be(false) +end