adds User#age

This commit is contained in:
Juanjo Bazán
2017-01-25 14:17:49 +01:00
parent 8d8d822323
commit 0b2454fb97
2 changed files with 15 additions and 0 deletions

View File

@@ -65,6 +65,13 @@ describe User do
end
end
describe "#age" do
it "is the rounded integer age based on the date_of_birth" do
user = create(:user, date_of_birth: 33.years.ago)
expect(user.age).to eq(33)
end
end
describe 'preferences' do
describe 'email_on_comment' do
it 'should be false by default' do