Slide 22
Slide 22 text
23
͕ϨϏϡʔͨ͠ςετίʔυ͜Ε
let(:user) { create(:user, birth_date: Faker::Date.birthday) }
let(:this_year) { Date.today.year }
let(:this_years_birthday) {
Date.new(this_year, user.birth_date.month, user.birth_date.day) }
let(:age) { this_year - user.birth_date.year }
context "ੜҎ߱ͷ߹" do
it "ੜΛա͗ͨྸ͕ฦΔ" do
travel_to(this_years_birthday)
expect(user.age).to eq(age)
end
end
context "ੜҎલͷ߹" do
it "ੜલͷྸ͕ฦΔ" do
travel_to(this_years_birthday.yesterday)
expect(user.age).to eq(age - 1)
end
end
ɿageϝιουͲΜͳ༷ʁ