From ef44422a43acebbc9b0062b3a26f25057dfcee13 Mon Sep 17 00:00:00 2001 From: dwin357 Date: Mon, 13 Jun 2016 11:33:55 -0400 Subject: [PATCH] a simple solution --- features/animal.feature | 24 ++++++++++++++++++++++- features/step_definitions/animal_steps.rb | 12 +++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/features/animal.feature b/features/animal.feature index aa25af6..ed43251 100644 --- a/features/animal.feature +++ b/features/animal.feature @@ -1 +1,23 @@ -#Create your feature here +Feature: Animal + In order to be greeted appropriately + I want to track an animal's name + I want to track an animal's age + I want to track an animal's type + I want to know if an animal is old + + Scenario: age + Given a animal + Then it has a "age" + + Scenario: type + Given a animal + Then it has a "type" + + Scenario: name + Given a animal + Then it has a "name" + + Scenario: old + Given a animal + When age is more than 3 + Then it should say it is old diff --git a/features/step_definitions/animal_steps.rb b/features/step_definitions/animal_steps.rb index 324ff13..3ef8bc2 100644 --- a/features/step_definitions/animal_steps.rb +++ b/features/step_definitions/animal_steps.rb @@ -1 +1,11 @@ -#Delete this comment, here is where you should write your step defs +Then(/^it has a "(.*?)"$/) do |attribute| + expect(@animal).to respond_to(attribute.to_sym) +end + +When(/^age is more than (\d+)$/) do |age_limit| + expect(@animal.age).to be >= age_limit.to_i +end + +Then(/^it should say it is old/) do + expect(@animal.old?).to be true +end