From 3a5928e83f6fa23dbb30432dba32be76c695476b Mon Sep 17 00:00:00 2001 From: kikito Date: Wed, 13 Apr 2016 12:06:43 +0200 Subject: [PATCH 1/2] aligns document verification with Madrid --- app/models/verification/management/document.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/verification/management/document.rb b/app/models/verification/management/document.rb index 481073397..fcbc19ca4 100644 --- a/app/models/verification/management/document.rb +++ b/app/models/verification/management/document.rb @@ -32,7 +32,7 @@ class Verification::Management::Document end def under_sixteen?(response) - 16.years.ago < response.date_of_birth + 16.years.ago.beginning_of_day < response.date_of_birth.beginning_of_day end def verified? From d7f9862290aa47b267432dba07aae850dd2d2126 Mon Sep 17 00:00:00 2001 From: kikito Date: Wed, 13 Apr 2016 12:06:50 +0200 Subject: [PATCH 2/2] fixes failing specs --- .../verification/management/document_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/models/verification/management/document_spec.rb b/spec/models/verification/management/document_spec.rb index b4140f7ed..35fd89855 100644 --- a/spec/models/verification/management/document_spec.rb +++ b/spec/models/verification/management/document_spec.rb @@ -3,35 +3,35 @@ require 'rails_helper' describe Verification::Management::Document do describe "#valid_age?" do it "returns false when the user is younger than sixteen years old" do - census_response = double(date_of_birth: "31-12-#{16.years.ago.year}") + census_response = double(date_of_birth: Date.new(16.years.ago.year, 12, 31)) expect(Verification::Management::Document.new.valid_age?(census_response)).to be false end it "returns true when the user is sixteen years old" do - census_response = double(date_of_birth: 16.years.ago.strftime("%d-%m-%Y")) + census_response = double(date_of_birth: Date.new(16.years.ago.year, 16.years.ago.month, 16.years.ago.day)) expect(Verification::Management::Document.new.valid_age?(census_response)).to be true end it "returns true when the user is older than sixteen years old" do - census_response = double(date_of_birth: "31-12-#{33.years.ago.year}") + census_response = double(date_of_birth: Date.new(33.years.ago.year, 12, 31)) expect(Verification::Management::Document.new.valid_age?(census_response)).to be true end end describe "#under_sixteen?" do it "returns true when the user is younger than sixteen years old" do - census_response = double(date_of_birth: "31-12-#{16.years.ago.year}") + census_response = double(date_of_birth: Date.new(16.years.ago.year, 12, 31)) expect(Verification::Management::Document.new.under_sixteen?(census_response)).to be true end it "returns false when the user is sixteen years old" do - census_response = double(date_of_birth: 16.years.ago.strftime("%d-%m-%Y")) + census_response = double(date_of_birth: Date.new(16.years.ago.year, 16.years.ago.month, 16.years.ago.day)) expect(Verification::Management::Document.new.under_sixteen?(census_response)).to be false end it "returns false when the user is older than sixteen years old" do - census_response = double(date_of_birth: "31-12-#{33.years.ago.year}") + census_response = double(date_of_birth: Date.new(33.years.ago.year, 12, 31)) expect(Verification::Management::Document.new.under_sixteen?(census_response)).to be false end end -end \ No newline at end of file +end