Skip to content

Commit

Permalink
Release 0.1.1 gem with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisyour committed Aug 24, 2010
1 parent da6c72e commit 13e8209
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
3 changes: 2 additions & 1 deletion geo_location.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Gem::Specification.new do |s|
s.name = %q{geo_location}
s.version = "0.1.0"
s.version = "0.1.1"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Chris Your"]
Expand All @@ -23,6 +23,7 @@ Gem::Specification.new do |s|
"README.rdoc",
"Rakefile",
"VERSION",
"geo_location.gemspec",
"lib/geo_location.rb",
"lib/geo_location/geo_location.rb",
"lib/geo_location/variables.rb",
Expand Down
2 changes: 2 additions & 0 deletions lib/geo_location.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'active_support/inflector'

require 'geo_location/variables'
require 'geo_location/geo_location'
require 'geo_location/version'
2 changes: 1 addition & 1 deletion lib/geo_location/geo_location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def valid_ip(ip)
# US,NY,Jamaica,40.676300,-73.775200

def maxmind(ip)
unless GeoLocation::test.empty?
unless GeoLocation::test.nil? || GeoLocation::test.empty?
puts "WARNING: GeoLocation is using the test location: #{GeoLocation::test}"
location = GeoLocation::test.split(',')
else
Expand Down
2 changes: 1 addition & 1 deletion lib/geo_location/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module GeoLocation
VERSION = "0.0.1"
VERSION = "0.1.1"
end
2 changes: 1 addition & 1 deletion test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
require 'geo_location'

class Test::Unit::TestCase
end
end
18 changes: 16 additions & 2 deletions test/test_geo_location.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
require 'helper'

class TestGeoLocation < Test::Unit::TestCase
should "probably rename this file and start testing for real" do
flunk "hey buddy, you should probably rename this file and start testing for real"
should "find CA country using hostip" do
GeoLocation::use = :hostip
ip = GeoLocation.find('142.59.52.238')
assert_equal ip[:country], 'CA'
end

should "find NY region using hostip" do
GeoLocation::use = :hostip
ip = GeoLocation.find('24.24.24.24')
assert_equal ip[:region], 'NY'
end

should "find Edmonton city using hostip" do
GeoLocation::use = :hostip
ip = GeoLocation.find('142.59.52.238')
assert_equal ip[:city], 'Edmonton'
end
end

0 comments on commit 13e8209

Please sign in to comment.