Skip to content

Commit

Permalink
Resolve Fixnum deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dxg committed Apr 22, 2021
1 parent b44b202 commit 774a72d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ rvm:
- 2.1
- 2.2
- 2.3.0
- 2.4.0
- 2.5.0
- 2.6.0
- 2.7.0
- 3.0.0
- ruby-head

before_install:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

### v2.9.0

* Resolve Fixnum deprecation warnings with Ruby 2.4+

### v2.8.1

* Create shared CLI module

### v2.8.0

* Add new diff-* executables for matching JSON & CSV files on the command line
Expand Down
2 changes: 1 addition & 1 deletion lib/diff_matcher/difference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def expected(e, actual)
opts = expected_opts(e)
size = opts[:size]
case size
when Fixnum
when 0.class
min = size
max = size
when Range
Expand Down
2 changes: 1 addition & 1 deletion lib/diff_matcher/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module DiffMatcher
VERSION = "2.8.1"
VERSION = "2.9.0"
end
22 changes: 11 additions & 11 deletions spec/diff_matcher/difference_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def fix_EOF_problem(s)

describe DiffMatcher::Matcher do
expected, expected2, same, different, difference =
{:nombre => String , :edad => Integer },
{:name => String , :age => Integer },
{:nombre => String , :edad => 0.class },
{:name => String , :age => 0.class },
{:name => "Peter" , :age => 21 },
{:name => 21 , :age => 21 },
"{\n :name=>\e[31m- \e[1mString\e[0m\e[33m+ \e[1m21\e[0m,\n :age=>\e[34m: \e[1m21\e[0m\n}\n"
Expand Down Expand Up @@ -126,7 +126,7 @@ def fix_EOF_problem(s)
subject { DiffMatcher::Matcher[expected].diff(actual, opts) }

describe "when expected is an instance," do
context "of Fixnum," do
context "of Integer," do
expected, same, different =
1,
1,
Expand All @@ -140,7 +140,7 @@ def fix_EOF_problem(s)
describe "when expected is an instance," do
context "of Hash, with optional keys" do
expected, same, different =
{:a=>1, :b=>Fixnum},
{:a=>1, :b=>0.class},
{:a=>1},
{:a=>2}

Expand All @@ -156,7 +156,7 @@ def fix_EOF_problem(s)
subject { DiffMatcher::difference(expected, actual, opts) }

describe "when expected is an instance," do
context "of Fixnum," do
context "of Integer," do
expected, same, different =
1,
1,
Expand Down Expand Up @@ -534,7 +534,7 @@ def description

context "or-ed with another DiffMatcher::Matcher," do
expected, same, different =
DiffMatcher::Matcher[Fixnum] | DiffMatcher::Matcher[String],
DiffMatcher::Matcher[0.class] | DiffMatcher::Matcher[String],
"a",
1.0

Expand Down Expand Up @@ -635,7 +635,7 @@ def description

context "a DiffMatcher::AllMatcher using an or-ed DiffMatcher::Matcher," do
expected, same, different =
DiffMatcher::AllMatcher[ DiffMatcher::Matcher[Fixnum, Float] ],
DiffMatcher::AllMatcher[ DiffMatcher::Matcher[0.class, Float] ],
[1, 2.0, 3],
[1, "2", 3]

Expand All @@ -653,8 +653,8 @@ def description
expected, same, different =
DiffMatcher::AllMatcher[
DiffMatcher::Matcher[
{:nombre=>String, :edad=>Fixnum},
{:name=>String, :age=>Fixnum}
{:nombre=>String, :edad=>0.class},
{:name=>String, :age=>0.class}
]
],
[
Expand All @@ -674,7 +674,7 @@ def description
| {:name=>"Alice", :age=>10},
{
:name=>: "Bob",
:age=>- Fixnum+ nil
:age=>- 0.class+ nil
},
| {:nombre=>"Con", :edad=>30}
]
Expand All @@ -698,7 +698,7 @@ def description
end
end
expected, same, different =
[ 1, 2, /\d/, Fixnum, 4..6 , lambda { |x| x % 6 == 0 }, matchable.new(7)],
[ 1, 2, /\d/, 0.class, 4..6 , lambda { |x| x % 6 == 0 }, matchable.new(7)],
[ 1, 2, "3" , 4 , 5 , 6 , 7 ],
[ 0, 2, "3" , 4 , 5 , 6 , 7 ]

Expand Down

0 comments on commit 774a72d

Please sign in to comment.