diff --git a/features/animal.feature b/features/animal.feature index aa25af6..3765e35 100644 --- a/features/animal.feature +++ b/features/animal.feature @@ -1 +1,10 @@ -#Create your feature here +Feature: Animal + + Scenario: Animal is a cat + Given an animal + When the animal is a Cat + And the anmial is named "Bob" + And the animal is 2 years old + Then the type should be "Cat" + And the name should be "Bob" + And the age should be 2 diff --git a/features/step_definitions/.greeter_steps.rb.swp b/features/step_definitions/.greeter_steps.rb.swp new file mode 100644 index 0000000..3cdc458 Binary files /dev/null and b/features/step_definitions/.greeter_steps.rb.swp differ diff --git a/features/step_definitions/animal_steps.rb b/features/step_definitions/animal_steps.rb index 324ff13..c9f58bc 100644 --- a/features/step_definitions/animal_steps.rb +++ b/features/step_definitions/animal_steps.rb @@ -1 +1,32 @@ -#Delete this comment, here is where you should write your step defs +Transform (/^(-?\d+)$/) do |number| + number.to_i +end + +Given(/^an animal$/) do + @animal = Animal.new('Bob', 'Cat', 2) +end + +When(/^the animal is a (.*?)$/) do |type| + expect(@animal.type).to eq type +end + +When(/^the anmial is named "(.*?)"$/) do |arg1| + expect(@animal.name).to eq arg1 +end + +When (/^the animal is (\d+) years old$/) do |age| + expect(@animal.age).to eq age +end + +Then (/^the type should be "(.*?)"$/) do |type| + expect(@animal.type).to eq type +end + +Then(/^the name should be "(.*?)"$/) do |name| + expect(@animal.name).to eq name +end + +Then(/^the age should be (\d+)$/) do |age| + expect(@animal.age).to eq age +end +