Skip to content

Commit

Permalink
replace Fixnum with Integer to fix ruby 2.4 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
jboler committed Feb 24, 2017
1 parent 384c52e commit ab97fb2
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion docs/Properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ The ``type`` option has some interesting qualities that are worth being aware of

- String
- Integer
- Fixnum
- BigDecimal
- Date
- Time
Expand Down
2 changes: 1 addition & 1 deletion docs/Querying.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ There are many ways to provide the length information to generate all the variou

.. code-block:: ruby
# As a Fixnum:
# As a Integer:
## Cypher: -[:`FRIENDS`*2]->
student.friends(rel_length: 2)
Expand Down
2 changes: 1 addition & 1 deletion lib/neo4j/active_node/has_n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def define_has_one_getter(name)

# Return all results if a variable-length relationship length was given
association_proxy = association_proxy(name, {node: node, rel: rel}.merge!(options))
if options[:rel_length] && !options[:rel_length].is_a?(Fixnum)
if options[:rel_length] && !options[:rel_length].is_a?(Integer)
association_proxy
else
target_class = self.class.send(:association_target_class, name)
Expand Down
6 changes: 3 additions & 3 deletions lib/neo4j/active_node/has_n/association_cypher_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def cypher_for_rel_length(length)

case length
when Symbol then VALID_REL_LENGTH_SYMBOLS[length]
when Fixnum then "*#{length}"
when Integer then "*#{length}"
when Range then cypher_for_range_rel_length(length)
when Hash then cypher_for_hash_rel_length(length)
end
Expand All @@ -79,11 +79,11 @@ def validate_rel_length!(length)

def rel_length_error_message(length)
case length
when Fixnum then 'cannot be negative' if length < 0
when Integer then 'cannot be negative' if length < 0
when Symbol then rel_length_symbol_error_message(length)
when Range then rel_length_range_error_message(length)
when Hash then rel_length_hash_error_message(length)
else 'should be a Symbol, Fixnum, Range or Hash'
else 'should be a Symbol, Integer, Range or Hash'
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/neo4j/active_node/query/query_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class QueryProxy
# @param [Hash] options Additional options pertaining to the QueryProxy object. These may include:
# @option options [String, Symbol] :node_var A string or symbol to be used by Cypher within its query string as an identifier
# @option options [String, Symbol] :rel_var Same as above but pertaining to a relationship identifier
# @option options [Range, Fixnum, Symbol, Hash] :rel_length A Range, a Fixnum, a Hash or a Symbol to indicate the variable-length/fixed-length
# @option options [Range, Integer, Symbol, Hash] :rel_length A Range, a Integer, a Hash or a Symbol to indicate the variable-length/fixed-length
# qualifier of the relationship. See http://neo4jrb.readthedocs.org/en/latest/Querying.html#variable-length-relationships.
# @option options [Neo4j::Session] :session The session to be used for this query
# @option options [Neo4j::ActiveNode] :source_object The node instance at the start of the QueryProxy chain
Expand Down
2 changes: 1 addition & 1 deletion lib/neo4j/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class << self
# timestamp inclusion.
# @return [Boolean] the true/false value specified.

# @return [Fixnum] The location of the default configuration file.
# @return [Integer] The location of the default configuration file.
def default_file
@default_file ||= DEFAULT_FILE
end
Expand Down
2 changes: 1 addition & 1 deletion spec/e2e/has_many_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def false_callback(_other)
end
end

context 'as Fixnum' do
context 'as Integer' do
it 'returns related nodes at exactly `length` hops from start node' do
expect(node.knows(:n, :r, rel_length: 1).to_a).to match_array([friend1])
expect(node.knows(:n, :r, rel_length: 2).to_a).to match_array([friend2])
Expand Down
8 changes: 4 additions & 4 deletions spec/unit/active_node/has_n/association_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def self._type
end
end

context 'as Fixnum' do
context 'as Integer' do
context 'positive' do
let(:length) { 42 }

Expand Down Expand Up @@ -235,7 +235,7 @@ def self._type
let(:length) { 'any' }

it 'raises an error' do
expect { subject }.to raise_error ArgumentError, 'Invalid value for rel_length ("any"): should be a Symbol, Fixnum, Range or Hash'
expect { subject }.to raise_error ArgumentError, 'Invalid value for rel_length ("any"): should be a Symbol, Integer, Range or Hash'
end
end

Expand Down Expand Up @@ -353,10 +353,10 @@ def self.name
end

context 'target_class_names defines class which exists, but is not ActiveNode' do
let(:options) { {type: nil, model_class: 'Fixnum'} }
let(:options) { {type: nil, model_class: 'Integer'} }

context 'with invalid target class name' do
it { expect { subject }.to raise_error ArgumentError, /Fixnum.* is not an ActiveNode model/ }
it { expect { subject }.to raise_error ArgumentError, /Integer.* is not an ActiveNode model/ }
end
end
end
Expand Down

0 comments on commit ab97fb2

Please sign in to comment.