Skip to content

Commit

Permalink
Merge pull request #132 from mcasper/ruby-2-4-warnings
Browse files Browse the repository at this point in the history
Replace Fixnum and Bignum with Integer
  • Loading branch information
sethpollack authored Apr 10, 2017
2 parents a55e8e2 + eef7105 commit 46050a4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ language: ruby
rvm:
- 2.2.3
- 2.3.1
- 2.4.1

script: bundle exec rspec spec
before_install:
Expand Down
22 changes: 15 additions & 7 deletions lib/airborne/request_expectations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,17 +231,17 @@ def ensure_hash_contains_prop(prop_name, hash)
end

def property?(expectations)
[String, Regexp, Float, Fixnum, Bignum, TrueClass, FalseClass, NilClass, Array].include?(expectations.class)
[String, Regexp, Float, *integer_types, TrueClass, FalseClass, NilClass, Array].include?(expectations.class)
end

def get_mapper
base_mapper = {
integer: [Fixnum, Bignum],
array_of_integers: [Fixnum, Bignum],
int: [Fixnum, Bignum],
array_of_ints: [Fixnum, Bignum],
float: [Float, Fixnum, Bignum],
array_of_floats: [Float, Fixnum, Bignum],
integer: integer_types,
array_of_integers: integer_types,
int: integer_types,
array_of_ints: integer_types,
float: [Float, *integer_types],
array_of_floats: [Float, *integer_types],
string: [String],
array_of_strings: [String],
boolean: [TrueClass, FalseClass],
Expand Down Expand Up @@ -283,5 +283,13 @@ def match_actual?
def match_expected?
Airborne.configuration.match_expected?
end

def integer_types
if 0.class == Integer
[Integer]
else
[Fixnum, Bignum]
end
end
end
end

0 comments on commit 46050a4

Please sign in to comment.