diff --git a/app/models/poll/voter.rb b/app/models/poll/voter.rb index 8fe612151..b05839501 100644 --- a/app/models/poll/voter.rb +++ b/app/models/poll/voter.rb @@ -50,10 +50,10 @@ class Poll if dob.blank? nil else - now = Time.now.utc.to_date + now = Time.current.to_date now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1) end end end -end \ No newline at end of file +end diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index 9898ad46f..baf137c2d 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -407,7 +407,7 @@ tags = Faker::Lorem.words(10) title: Faker::Lorem.sentence(3).truncate(60), external_url: Faker::Internet.url, description: "
#{Faker::Lorem.paragraphs.join('
')}
", - created_at: rand((Time.now - 1.week) .. Time.now), + created_at: rand((Time.current - 1.week) .. Time.current), feasibility: %w{undecided unfeasible feasible feasible feasible feasible}.sample, unfeasibility_explanation: Faker::Lorem.paragraph, valuation_finished: [false, true].sample, @@ -436,7 +436,7 @@ budget = Budget.where(phase: "finished").last title: Faker::Lorem.sentence(3).truncate(60), external_url: Faker::Internet.url, description: "#{Faker::Lorem.paragraphs.join('
')}
", - created_at: rand((Time.now - 1.week) .. Time.now), + created_at: rand((Time.current - 1.week) .. Time.current), feasibility: "feasible", valuation_finished: true, selected: true, diff --git a/lib/age.rb b/lib/age.rb index c6ae6fe18..f0ca9abe0 100644 --- a/lib/age.rb +++ b/lib/age.rb @@ -1,5 +1,5 @@ module Age - def self.in_years(dob, now = Time.now.utc.to_date) + def self.in_years(dob, now = Time.current.to_date) return nil unless dob.present? # reference: http://stackoverflow.com/questions/819263/get-persons-age-in-ruby#comment21200772_819263 now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1) diff --git a/spec/features/budgets/votes_spec.rb b/spec/features/budgets/votes_spec.rb index 497046891..95f040bb3 100644 --- a/spec/features/budgets/votes_spec.rb +++ b/spec/features/budgets/votes_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' feature 'Votes' do background do - @manuela = create(:user, verified_at: Time.now) + @manuela = create(:user, verified_at: Time.current) end feature 'Investments' do diff --git a/spec/models/direct_message_spec.rb b/spec/models/direct_message_spec.rb index e982f9e56..05c3f75cd 100644 --- a/spec/models/direct_message_spec.rb +++ b/spec/models/direct_message_spec.rb @@ -65,9 +65,9 @@ describe DirectMessage do describe "today" do it "should return direct messages created today" do - direct_message1 = create(:direct_message, created_at: Time.zone.now.beginning_of_day + 3.hours) - direct_message2 = create(:direct_message, created_at: Time.zone.now) - direct_message3 = create(:direct_message, created_at: Time.zone.now.end_of_day) + direct_message1 = create(:direct_message, created_at: Time.current.beginning_of_day + 3.hours) + direct_message2 = create(:direct_message, created_at: Time.current) + direct_message3 = create(:direct_message, created_at: Time.current.end_of_day) expect(DirectMessage.today.count).to eq 3 end @@ -82,4 +82,4 @@ describe DirectMessage do end -end \ No newline at end of file +end