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 identify each animal
As a hotel owner
I want to know its name, type, age, and if it is old.

Scenario: details
Given an animal
When its name is "Ein"
And its type is "dog"
And its age is 5
Then it should be "old"
2 changes: 1 addition & 1 deletion features/greeter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Feature: Greeter
In order to properly address senior animals
As a old cat
I want to be greeted as 'Mr Cat'

Scenario: Cat
Given a animal
When older than 3
Expand Down
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(/^an animal$/) do
@animal = Animal.new('Ein', 'dog', 5)
end

When(/^its name is "(.*?)"$/) do |name|
expect(@animal.name).to eq name
end

When(/^its type is "(.*?)"$/) do |type|
expect(@animal.type).to eq type
end

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

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