Skip to content

Commit a0e9745

Browse files
authored
Merge pull request #841 from rahul342/master
Fix bug for equal params to georadius. Allow array param for geoadd
2 parents df07a4c + 399b6aa commit a0e9745

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

lib/redis.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,7 +2818,7 @@ def pfmerge(dest_key, *source_key)
28182818
# @return [Intger] number of elements added to the sorted set
28192819
def geoadd(key, *member)
28202820
synchronize do |client|
2821-
client.call([:geoadd, key, member])
2821+
client.call([:geoadd, key, *member])
28222822
end
28232823
end
28242824

@@ -3441,8 +3441,7 @@ def _geoarguments(*args, options: nil, sort: nil, count: nil)
34413441
args.push sort if sort
34423442
args.push 'count', count if count
34433443
args.push options if options
3444-
3445-
args.uniq
3444+
args
34463445
end
34473446

34483447
def _subscription(method, timeout, channels, block)

test/commands_on_geo_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ def setup
1212
end
1313
end
1414

15+
def test_geoadd_with_array_params
16+
target_version "3.2.0" do
17+
added_items_count = r.geoadd("SicilyArray", [13.361389, 38.115556, "Palermo", 15.087269, 37.502669, "Catania"])
18+
assert_equal 2, added_items_count
19+
end
20+
end
21+
22+
def test_georadius_with_same_params
23+
target_version "3.2.0" do
24+
r.geoadd("Chad", 15, 15, "Kanem")
25+
nearest_cities = r.georadius("Chad", 15, 15, 15, 'km', sort: 'asc')
26+
assert_equal %w(Kanem), nearest_cities
27+
end
28+
end
29+
1530
def test_georadius_with_sort
1631
target_version "3.2.0" do
1732
nearest_cities = r.georadius("Sicily", 15, 37, 200, 'km', sort: 'asc')

0 commit comments

Comments
 (0)