From 293a815fbe5d69ffc1228569a15cb3bf906587c8 Mon Sep 17 00:00:00 2001 From: Shubhendra Singh Chauhan Date: Thu, 15 Apr 2021 21:14:33 +0530 Subject: [PATCH] fix: issues affecting code quality (#1420) * use `delegate` for delegation * Time should be used with zone --- lib/shoulda/matchers/action_controller/flash_store.rb | 6 ++---- .../matchers/active_model/validate_absence_of_matcher.rb | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/shoulda/matchers/action_controller/flash_store.rb b/lib/shoulda/matchers/action_controller/flash_store.rb index d48fef72..8c96400c 100644 --- a/lib/shoulda/matchers/action_controller/flash_store.rb +++ b/lib/shoulda/matchers/action_controller/flash_store.rb @@ -1,3 +1,4 @@ +require 'active_support/core_ext/module/delegation' module Shoulda module Matchers module ActionController @@ -34,10 +35,7 @@ module Shoulda expected_value === actual_value end end - - def empty? - flash.empty? - end + delegate :empty?, to: :flash def use_now! @use_now = true diff --git a/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb index 084b0b28..7a89baff 100644 --- a/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb @@ -113,7 +113,7 @@ module Shoulda case column_type when :integer, :float then 1 when :decimal then BigDecimal(1, 0) - when :datetime, :time, :timestamp then Time.now + when :datetime, :time, :timestamp then Time.current when :date then Date.new when :binary then '0' else 'an arbitrary value'