Skip to content

Commit 9fb39ee

Browse files
committed
Skip geo* tests for Redis 3.0
1 parent ea676da commit 9fb39ee

File tree

1 file changed

+64
-38
lines changed

1 file changed

+64
-38
lines changed

test/commands_on_geo_test.rb

Lines changed: 64 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,85 +6,111 @@ class TestCommandsGeo < Test::Unit::TestCase
66
def setup
77
super
88

9-
added_items_count = r.geoadd("Sicily", 13.361389, 38.115556, "Palermo", 15.087269, 37.502669, "Catania")
10-
assert_equal 2, added_items_count
9+
target_version "3.2.0" do
10+
added_items_count = r.geoadd("Sicily", 13.361389, 38.115556, "Palermo", 15.087269, 37.502669, "Catania")
11+
assert_equal 2, added_items_count
12+
end
1113
end
1214

1315
def test_georadius_with_sort
14-
nearest_cities = r.georadius("Sicily", 15, 37, 200, 'km', sort: 'asc')
15-
assert_equal %w(Catania Palermo), nearest_cities
16+
target_version "3.2.0" do
17+
nearest_cities = r.georadius("Sicily", 15, 37, 200, 'km', sort: 'asc')
18+
assert_equal %w(Catania Palermo), nearest_cities
1619

17-
farthest_cities = r.georadius("Sicily", 15, 37, 200, 'km', sort: 'desc')
18-
assert_equal %w(Palermo Catania), farthest_cities
20+
farthest_cities = r.georadius("Sicily", 15, 37, 200, 'km', sort: 'desc')
21+
assert_equal %w(Palermo Catania), farthest_cities
22+
end
1923
end
2024

2125
def test_georadius_with_count
22-
city = r.georadius("Sicily", 15, 37, 200, 'km', count: 1)
23-
assert_equal %w(Catania), city
26+
target_version "3.2.0" do
27+
city = r.georadius("Sicily", 15, 37, 200, 'km', count: 1)
28+
assert_equal %w(Catania), city
29+
end
2430
end
2531

2632
def test_georadius_with_options_count_sort
27-
city = r.georadius("Sicily", 15, 37, 200, 'km', sort: :desc, options: :WITHDIST, count: 1)
28-
assert_equal [["Palermo", "190.4424"]], city
33+
target_version "3.2.0" do
34+
city = r.georadius("Sicily", 15, 37, 200, 'km', sort: :desc, options: :WITHDIST, count: 1)
35+
assert_equal [["Palermo", "190.4424"]], city
36+
end
2937
end
3038

3139
def test_georadiusbymember_with_sort
32-
nearest_cities = r.georadiusbymember("Sicily", "Catania", 200, 'km', sort: 'asc')
33-
assert_equal %w(Catania Palermo), nearest_cities
40+
target_version "3.2.0" do
41+
nearest_cities = r.georadiusbymember("Sicily", "Catania", 200, 'km', sort: 'asc')
42+
assert_equal %w(Catania Palermo), nearest_cities
3443

35-
farthest_cities = r.georadiusbymember("Sicily", "Catania", 200, 'km', sort: 'desc')
36-
assert_equal %w(Palermo Catania), farthest_cities
44+
farthest_cities = r.georadiusbymember("Sicily", "Catania", 200, 'km', sort: 'desc')
45+
assert_equal %w(Palermo Catania), farthest_cities
46+
end
3747
end
3848

3949
def test_georadiusbymember_with_count
40-
city = r.georadiusbymember("Sicily", "Catania", 200, 'km', count: 1)
41-
assert_equal %w(Catania), city
50+
target_version "3.2.0" do
51+
city = r.georadiusbymember("Sicily", "Catania", 200, 'km', count: 1)
52+
assert_equal %w(Catania), city
53+
end
4254
end
4355

4456
def test_georadiusbymember_with_options_count_sort
45-
city = r.georadiusbymember("Sicily", "Catania", 200, 'km', sort: :desc, options: :WITHDIST, count: 1)
46-
assert_equal [["Palermo", "166.2742"]], city
57+
target_version "3.2.0" do
58+
city = r.georadiusbymember("Sicily", "Catania", 200, 'km', sort: :desc, options: :WITHDIST, count: 1)
59+
assert_equal [["Palermo", "166.2742"]], city
60+
end
4761
end
4862

4963
def test_geopos
50-
location = r.geopos("Sicily", "Catania")
51-
assert_equal [["15.08726745843887329", "37.50266842333162032"]], location
64+
target_version "3.2.0" do
65+
location = r.geopos("Sicily", "Catania")
66+
assert_equal [["15.08726745843887329", "37.50266842333162032"]], location
5267

53-
locations = r.geopos("Sicily", ["Palermo", "Catania"])
54-
assert_equal [["13.36138933897018433", "38.11555639549629859"], ["15.08726745843887329", "37.50266842333162032"]], locations
68+
locations = r.geopos("Sicily", ["Palermo", "Catania"])
69+
assert_equal [["13.36138933897018433", "38.11555639549629859"], ["15.08726745843887329", "37.50266842333162032"]], locations
70+
end
5571
end
5672

5773
def test_geopos_nonexistant_location
58-
location = r.geopos("Sicily", "Rome")
59-
assert_equal [nil], location
74+
target_version "3.2.0" do
75+
location = r.geopos("Sicily", "Rome")
76+
assert_equal [nil], location
6077

61-
locations = r.geopos("Sicily", ["Rome", "Catania"])
62-
assert_equal [nil, ["15.08726745843887329", "37.50266842333162032"]], locations
78+
locations = r.geopos("Sicily", ["Rome", "Catania"])
79+
assert_equal [nil, ["15.08726745843887329", "37.50266842333162032"]], locations
80+
end
6381
end
6482

6583
def test_geodist
66-
distination_in_meters = r.geodist("Sicily", "Palermo", "Catania")
67-
assert_equal "166274.1516", distination_in_meters
84+
target_version "3.2.0" do
85+
distination_in_meters = r.geodist("Sicily", "Palermo", "Catania")
86+
assert_equal "166274.1516", distination_in_meters
6887

69-
distination_in_feet = r.geodist("Sicily", "Palermo", "Catania", 'ft')
70-
assert_equal "545518.8700", distination_in_feet
88+
distination_in_feet = r.geodist("Sicily", "Palermo", "Catania", 'ft')
89+
assert_equal "545518.8700", distination_in_feet
90+
end
7191
end
7292

7393
def test_geodist_with_nonexistant_location
74-
distination = r.geodist("Sicily", "Palermo", "Rome")
75-
assert_equal nil, distination
94+
target_version "3.2.0" do
95+
distination = r.geodist("Sicily", "Palermo", "Rome")
96+
assert_equal nil, distination
97+
end
7698
end
7799

78100
def test_geohash
79-
geohash = r.geohash("Sicily", "Palermo")
80-
assert_equal ["sqc8b49rny0"], geohash
101+
target_version "3.2.0" do
102+
geohash = r.geohash("Sicily", "Palermo")
103+
assert_equal ["sqc8b49rny0"], geohash
81104

82-
geohashes = r.geohash("Sicily", ["Palermo", "Catania"])
83-
assert_equal %w(sqc8b49rny0 sqdtr74hyu0), geohashes
105+
geohashes = r.geohash("Sicily", ["Palermo", "Catania"])
106+
assert_equal %w(sqc8b49rny0 sqdtr74hyu0), geohashes
107+
end
84108
end
85109

86110
def test_geohash_with_nonexistant_location
87-
geohashes = r.geohash("Sicily", ["Palermo", "Rome"])
88-
assert_equal ["sqc8b49rny0", nil], geohashes
111+
target_version "3.2.0" do
112+
geohashes = r.geohash("Sicily", ["Palermo", "Rome"])
113+
assert_equal ["sqc8b49rny0", nil], geohashes
114+
end
89115
end
90116
end

0 commit comments

Comments
 (0)