Skip to content

Added age method and can drink check.#2

Open
lillypiri wants to merge 2 commits intomasterfrom
lilly
Open

Added age method and can drink check.#2
lillypiri wants to merge 2 commits intomasterfrom
lilly

Conversation

@lillypiri
Copy link

No description provided.

human = Human.new('Garfield')
human.age = 18
expect(human.can_drink? 'Australia').to be true
expect(human.can_drink? 'United States').to be false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test to see what happens when we use an address that does not match one in our list

human = Human.new('Boris Jr')
human.age = 14
expect(human.can_drink?).to be false

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try not to leave blank lines between the end

end
end

describe '.can_drink?' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work that you put all the expectations inside of one describe block

models/human.rb Outdated
end


AGES = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great foresight here... Only small suggestion, this would be better to put in another file (or in Rails we would of had it in a DB table) to reduce the noise in the model
In this case it might be better to make this another class that you can ask for drinking_ages (as per comment below in specs). We can discuss this further next week

human.age = 18
expect(human.can_drink? 'Australia').to be true
expect(human.can_drink? 'United States').to be false
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add another test and not set age and see what happens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants