-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Conversation
human = Human.new('Garfield') | ||
human.age = 18 | ||
expect(human.can_drink? 'Australia').to be true | ||
expect(human.can_drink? 'United States').to be false |
There was a problem hiding this comment.
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
specs/models/human_spec.rb
Outdated
human = Human.new('Boris Jr') | ||
human.age = 14 | ||
expect(human.can_drink?).to be false | ||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
No description provided.