gotascii-crags 1.4.5 → 1.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/crags.gemspec +1 -1
- data/lib/crags/searcher.rb +5 -2
- data/lib/crags.rb +1 -1
- data/test/crags/searcher_test.rb +7 -0
- metadata +1 -1
data/crags.gemspec
CHANGED
data/lib/crags/searcher.rb
CHANGED
@@ -25,8 +25,11 @@ module Crags
|
|
25
25
|
|
26
26
|
def locations(country)
|
27
27
|
linkz = location_links(country)
|
28
|
-
|
29
|
-
|
28
|
+
if linkz.empty?
|
29
|
+
[strip_http(location_request(country).last_effective_url)]
|
30
|
+
else
|
31
|
+
linkz.collect{|link| strip_http(link["href"]) }
|
32
|
+
end
|
30
33
|
end
|
31
34
|
|
32
35
|
def categories
|
data/lib/crags.rb
CHANGED
data/test/crags/searcher_test.rb
CHANGED
@@ -34,6 +34,13 @@ class Crags::SearcherTest < Test::Unit::TestCase
|
|
34
34
|
locations('us').should == ["url0", "url1"]
|
35
35
|
end
|
36
36
|
|
37
|
+
should "locations should return array of one url using location_urls last_effective_url when no links are present on location_url page" do
|
38
|
+
stubs(:location_links).returns([])
|
39
|
+
req = mock(:last_effective_url => 'http://url.org/')
|
40
|
+
stubs(:location_request).with('us').returns(req)
|
41
|
+
locations('us').should == ["url.org"]
|
42
|
+
end
|
43
|
+
|
37
44
|
should "search should search location for each location with keyword and return list" do
|
38
45
|
locations = ["url0", "url1"]
|
39
46
|
|