Blob Blame History Raw
From 03a1d213805a44a0aec99857e01cab8524aa0c05 Mon Sep 17 00:00:00 2001
From: Dmitri Koulikoff <dima@koulikoff.ru>
Date: Tue, 25 Jul 2017 16:45:07 +0200
Subject: [PATCH] Deprecation for ruby 2.4 removed

Secondary credit: camelmasa <camelmasa@gmail.com>
---
 .../active_model/validate_inclusion_of_matcher.rb      | 10 +++++-----
 .../active_model/validate_inclusion_of_matcher_spec.rb |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb
index a1c68d79..717eecc9 100644
--- a/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb
+++ b/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb
@@ -269,7 +269,7 @@ def validate_inclusion_of(attr)
       # @private
       class ValidateInclusionOfMatcher < ValidationMatcher
         ARBITRARY_OUTSIDE_STRING = 'shoulda-matchers test string'
-        ARBITRARY_OUTSIDE_FIXNUM = 123456789
+        ARBITRARY_OUTSIDE_INTEGER = 123456789
         ARBITRARY_OUTSIDE_DECIMAL = BigDecimal.new('0.123456789')
         ARBITRARY_OUTSIDE_DATE = Date.jd(9999999)
         ARBITRARY_OUTSIDE_DATETIME = DateTime.jd(9999999)
@@ -483,8 +483,8 @@ def outside_values
           case attribute_type
           when :boolean
             boolean_outside_values
-          when :fixnum
-            [ARBITRARY_OUTSIDE_FIXNUM]
+          when :integer
+            [ARBITRARY_OUTSIDE_INTEGER]
           when :decimal
             [ARBITRARY_OUTSIDE_DECIMAL]
           when :date
@@ -538,7 +538,7 @@ def attribute_column
 
         def column_type_to_attribute_type(type)
           case type
-            when :integer, :float then :fixnum
+            when :float then :integer
             when :timestamp then :datetime
             else type
           end
@@ -548,7 +548,7 @@ def value_to_attribute_type(value)
           case value
             when true, false then :boolean
             when BigDecimal then :decimal
-            when Fixnum then :fixnum
+            when Integer then :integer
             when Date then :date
             when DateTime then :datetime
             when Time then :time
diff --git a/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb b/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb
index 62a322d4..5053c547 100644
--- a/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb
+++ b/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb
@@ -25,7 +25,7 @@ def self.testing_values_of_option(option_name, &block)
       it_behaves_like 'it supports in_array',
         possible_values: (1..5).to_a,
         zero: 0,
-        reserved_outside_value: described_class::ARBITRARY_OUTSIDE_FIXNUM
+        reserved_outside_value: described_class::ARBITRARY_OUTSIDE_INTEGER
 
       it_behaves_like 'it supports in_range',
         possible_values: 1..5,
@@ -82,7 +82,7 @@ def expect_to_match_on_values(builder, values, &block)
       it_behaves_like 'it supports in_array',
         possible_values: [1.0, 2.0, 3.0, 4.0, 5.0],
         zero: 0.0,
-        reserved_outside_value: described_class::ARBITRARY_OUTSIDE_FIXNUM
+        reserved_outside_value: described_class::ARBITRARY_OUTSIDE_INTEGER
 
       it_behaves_like 'it supports in_range',
         possible_values: 1.0..5.0,