gotascii-crags 1.4.5 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/crags.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{crags}
5
- s.version = "1.4.5"
5
+ s.version = "1.4.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Justin Marney"]
@@ -25,8 +25,11 @@ module Crags
25
25
 
26
26
  def locations(country)
27
27
  linkz = location_links(country)
28
- linkz = [location_request(country).last_effective_url] if linkz.empty?
29
- linkz.collect{|link| strip_http(link["href"]) }
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
@@ -4,7 +4,7 @@ require 'hpricot'
4
4
  require 'erb'
5
5
 
6
6
  module Crags
7
- VERSION = '1.4.5'
7
+ VERSION = '1.4.6'
8
8
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
9
9
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
10
10
 
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gotascii-crags
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Marney