Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added age method and can drink check. #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added age method and can drink check. #2

wants to merge 2 commits into from

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