muck-friends 0.1.16 → 0.1.17

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.
Files changed (54) hide show
  1. data/VERSION +1 -1
  2. data/app/controllers/muck/friends_controller.rb +2 -2
  3. data/muck-friends.gemspec +36 -6
  4. data/test/rails_root/Rakefile +8 -0
  5. data/test/rails_root/config/database.yml +14 -15
  6. data/test/rails_root/config/environment.rb +3 -1
  7. data/test/rails_root/config/initializers/geokit_config.rb +63 -0
  8. data/test/rails_root/db/migrate/{20090602041838_create_users.rb → 20090327231918_create_users.rb} +11 -10
  9. data/test/rails_root/db/migrate/20090402234137_create_languages.rb +1 -1
  10. data/test/rails_root/db/migrate/20090818204527_add_activity_indexes.rb +9 -0
  11. data/test/rails_root/db/migrate/20090819030523_add_attachable_to_activities.rb +13 -0
  12. data/test/rails_root/db/migrate/20091124203137_add_location_to_profiles.rb +15 -0
  13. data/test/rails_root/db/migrate/20091124205819_add_fields_to_profiles.rb +21 -0
  14. data/test/rails_root/public/images/fancybox/fancy_shadow_e.png +0 -0
  15. data/test/rails_root/public/images/fancybox/fancy_shadow_n.png +0 -0
  16. data/test/rails_root/public/images/fancybox/fancy_shadow_ne.png +0 -0
  17. data/test/rails_root/public/images/fancybox/fancy_shadow_nw.png +0 -0
  18. data/test/rails_root/public/images/fancybox/fancy_shadow_s.png +0 -0
  19. data/test/rails_root/public/images/fancybox/fancy_shadow_se.png +0 -0
  20. data/test/rails_root/public/images/fancybox/fancy_shadow_sw.png +0 -0
  21. data/test/rails_root/public/images/fancybox/fancy_shadow_w.png +0 -0
  22. data/test/rails_root/public/javascripts/jquery/jquery.fancybox.js +13 -6
  23. data/test/rails_root/public/javascripts/jquery/jquery.tips.js +7 -6
  24. data/test/rails_root/public/javascripts/muck.js +50 -3
  25. data/test/rails_root/public/javascripts/muck_activities.js +4 -5
  26. data/test/rails_root/public/stylesheets/jquery/jquery.fancybox.css +19 -25
  27. data/test/rails_root/public/stylesheets/styles.css +2 -0
  28. data/test/rails_root/test/functional/friends_controller_test.rb +1 -1
  29. data/test/rails_root/vendor/plugins/geokit-rails/init.rb +2 -0
  30. data/test/rails_root/vendor/plugins/geokit-rails/install.rb +14 -0
  31. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails.rb +26 -0
  32. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb +456 -0
  33. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/abstract.rb +31 -0
  34. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/mysql.rb +22 -0
  35. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/postgresql.rb +22 -0
  36. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/sqlserver.rb +43 -0
  37. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/defaults.rb +22 -0
  38. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/geocoder_control.rb +16 -0
  39. data/test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/ip_geocode_lookup.rb +46 -0
  40. data/test/rails_root/vendor/plugins/geokit-rails/test/acts_as_mappable_test.rb +474 -0
  41. data/test/rails_root/vendor/plugins/geokit-rails/test/boot.rb +25 -0
  42. data/test/rails_root/vendor/plugins/geokit-rails/test/ip_geocode_lookup_test.rb +77 -0
  43. data/test/rails_root/vendor/plugins/geokit-rails/test/models/company.rb +3 -0
  44. data/test/rails_root/vendor/plugins/geokit-rails/test/models/custom_location.rb +12 -0
  45. data/test/rails_root/vendor/plugins/geokit-rails/test/models/location.rb +4 -0
  46. data/test/rails_root/vendor/plugins/geokit-rails/test/models/mock_address.rb +4 -0
  47. data/test/rails_root/vendor/plugins/geokit-rails/test/models/mock_family.rb +3 -0
  48. data/test/rails_root/vendor/plugins/geokit-rails/test/models/mock_house.rb +3 -0
  49. data/test/rails_root/vendor/plugins/geokit-rails/test/models/mock_organization.rb +4 -0
  50. data/test/rails_root/vendor/plugins/geokit-rails/test/models/mock_person.rb +4 -0
  51. data/test/rails_root/vendor/plugins/geokit-rails/test/models/store.rb +3 -0
  52. data/test/rails_root/vendor/plugins/geokit-rails/test/schema.rb +60 -0
  53. data/test/rails_root/vendor/plugins/geokit-rails/test/test_helper.rb +23 -0
  54. metadata +33 -4
@@ -0,0 +1,25 @@
1
+ require 'active_support'
2
+ require 'active_support/test_case'
3
+
4
+ require 'test/unit'
5
+ require 'test/unit/testcase'
6
+ require 'active_support/testing/setup_and_teardown'
7
+
8
+ require 'active_record'
9
+ require 'active_record/fixtures'
10
+
11
+ require 'action_controller'
12
+ require 'action_controller/test_process'
13
+
14
+ PLUGIN_ROOT = File.join(File.dirname(__FILE__), '..')
15
+ ADAPTER = ENV['DB'] || 'mysql'
16
+
17
+ $LOAD_PATH << File.join(PLUGIN_ROOT, 'lib') << File.join(PLUGIN_ROOT, 'test', 'models')
18
+
19
+ FIXTURES_PATH = File.join(PLUGIN_ROOT, 'test', 'fixtures')
20
+ ActiveRecord::Base.configurations = config = YAML::load(IO.read(File.join(PLUGIN_ROOT, 'test', 'database.yml')))
21
+ ActiveRecord::Base.logger = Logger.new(File.join(PLUGIN_ROOT, 'test', "#{ADAPTER}-debug.log"))
22
+ ActiveRecord::Base.establish_connection(config[ADAPTER])
23
+
24
+ ActiveRecord::Migration.verbose = false
25
+ load File.join(PLUGIN_ROOT, 'test', 'schema.rb')
@@ -0,0 +1,77 @@
1
+ require 'test_helper'
2
+
3
+ ActionController::Routing::Routes.draw do |map|
4
+ map.connect ':controller/:action/:id'
5
+ end
6
+
7
+ class LocationAwareController < ActionController::Base #:nodoc: all
8
+ geocode_ip_address
9
+
10
+ def index
11
+ render :nothing => true
12
+ end
13
+
14
+ def rescue_action(e) raise e end;
15
+ end
16
+
17
+ class ActionController::TestRequest #:nodoc: all
18
+ attr_accessor :remote_ip
19
+ end
20
+
21
+ class IpGeocodeLookupTest < ActionController::TestCase
22
+ tests LocationAwareController
23
+
24
+ def setup
25
+ @success = GeoKit::GeoLoc.new
26
+ @success.provider = "hostip"
27
+ @success.lat = 41.7696
28
+ @success.lng = -88.4588
29
+ @success.city = "Sugar Grove"
30
+ @success.state = "IL"
31
+ @success.country_code = "US"
32
+ @success.success = true
33
+
34
+ @failure = GeoKit::GeoLoc.new
35
+ @failure.provider = "hostip"
36
+ @failure.city = "(Private Address)"
37
+ @failure.success = false
38
+ end
39
+
40
+ def test_no_location_in_cookie_or_session
41
+ Geokit::Geocoders::MultiGeocoder.expects(:geocode).with("good ip").returns(@success)
42
+ @request.remote_ip = "good ip"
43
+ get :index
44
+ verify
45
+ end
46
+
47
+ def test_location_in_cookie
48
+ @request.remote_ip = "good ip"
49
+ @request.cookies['geo_location'] = @success.to_yaml
50
+ get :index
51
+ verify
52
+ end
53
+
54
+ def test_location_in_session
55
+ @request.remote_ip = "good ip"
56
+ @request.session[:geo_location] = @success
57
+ @request.cookies['geo_location'] = CGI::Cookie.new('geo_location', @success.to_yaml)
58
+ get :index
59
+ verify
60
+ end
61
+
62
+ def test_ip_not_located
63
+ Geokit::Geocoders::MultiGeocoder.expects(:geocode).with("bad ip").returns(@failure)
64
+ @request.remote_ip = "bad ip"
65
+ get :index
66
+ assert_nil @request.session[:geo_location]
67
+ end
68
+
69
+ private
70
+
71
+ def verify
72
+ assert_response :success
73
+ assert_equal @success, @request.session[:geo_location]
74
+ assert_not_nil cookies['geo_location']
75
+ assert_equal @success, YAML.load(cookies['geo_location'])
76
+ end
77
+ end
@@ -0,0 +1,3 @@
1
+ class Company < ActiveRecord::Base
2
+ has_many :locations
3
+ end
@@ -0,0 +1,12 @@
1
+ class CustomLocation < ActiveRecord::Base
2
+ belongs_to :company
3
+ acts_as_mappable :distance_column_name => 'dist',
4
+ :default_units => :kms,
5
+ :default_formula => :flat,
6
+ :lat_column_name => 'latitude',
7
+ :lng_column_name => 'longitude'
8
+
9
+ def to_s
10
+ "lat: #{latitude} lng: #{longitude} dist: #{dist}"
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ class Location < ActiveRecord::Base
2
+ belongs_to :company
3
+ acts_as_mappable
4
+ end
@@ -0,0 +1,4 @@
1
+ class MockAddress < ActiveRecord::Base
2
+ belongs_to :addressable, :polymorphic => true
3
+ acts_as_mappable
4
+ end
@@ -0,0 +1,3 @@
1
+ class MockFamily < ActiveRecord::Base
2
+ belongs_to :mock_house
3
+ end
@@ -0,0 +1,3 @@
1
+ class MockHouse < ActiveRecord::Base
2
+ acts_as_mappable
3
+ end
@@ -0,0 +1,4 @@
1
+ class MockOrganization < ActiveRecord::Base
2
+ has_one :mock_address, :as => :addressable
3
+ acts_as_mappable :through => :mock_address
4
+ end
@@ -0,0 +1,4 @@
1
+ class MockPerson < ActiveRecord::Base
2
+ belongs_to :mock_family
3
+ acts_as_mappable :through => { :mock_family => :mock_house }
4
+ end
@@ -0,0 +1,3 @@
1
+ class Store < ActiveRecord::Base
2
+ acts_as_mappable :auto_geocode => true
3
+ end
@@ -0,0 +1,60 @@
1
+ ActiveRecord::Schema.define(:version => 0) do
2
+ create_table :companies, :force => true do |t|
3
+ t.column :name, :string
4
+ end
5
+
6
+ create_table :locations, :force => true do |t|
7
+ t.column :company_id, :integer, :default => 0, :null => false
8
+ t.column :street, :string, :limit => 60
9
+ t.column :city, :string, :limit => 60
10
+ t.column :state, :string, :limit => 2
11
+ t.column :postal_code, :string, :limit => 16
12
+ t.column :lat, :decimal, :precision => 15, :scale => 10
13
+ t.column :lng, :decimal, :precision => 15, :scale => 10
14
+ end
15
+
16
+ create_table :custom_locations, :force => true do |t|
17
+ t.column :company_id, :integer, :default => 0, :null => false
18
+ t.column :street, :string, :limit => 60
19
+ t.column :city, :string, :limit => 60
20
+ t.column :state, :string, :limit => 2
21
+ t.column :postal_code, :string, :limit => 16
22
+ t.column :latitude, :decimal, :precision => 15, :scale => 10
23
+ t.column :longitude, :decimal, :precision => 15, :scale => 10
24
+ end
25
+
26
+ create_table :stores, :force=> true do |t|
27
+ t.column :address, :string
28
+ t.column :lat, :decimal, :precision => 15, :scale => 10
29
+ t.column :lng, :decimal, :precision => 15, :scale => 10
30
+ end
31
+
32
+ create_table :mock_organizations, :force => true do |t|
33
+ t.column :name, :string
34
+ end
35
+
36
+ create_table :mock_addresses, :force => true do |t|
37
+ t.column :addressable_id, :integer, :null => false
38
+ t.column :addressable_type, :string, :null => false
39
+ t.column :street, :string, :limit => 60
40
+ t.column :city, :string, :limit => 60
41
+ t.column :state, :string, :limit => 2
42
+ t.column :postal_code, :string, :limit => 16
43
+ t.column :lat, :decimal, :precision => 15, :scale => 10
44
+ t.column :lng, :decimal, :precision => 15, :scale => 10
45
+ end
46
+
47
+ create_table :mock_houses, :force=> true do |t|
48
+ t.column :address, :string
49
+ t.column :lat, :decimal, :precision => 15, :scale => 10
50
+ t.column :lng, :decimal, :precision => 15, :scale => 10
51
+ end
52
+
53
+ create_table :mock_families, :force => true do |t|
54
+ t.belongs_to :mock_house
55
+ end
56
+
57
+ create_table :mock_people, :force => true do |t|
58
+ t.belongs_to :mock_family
59
+ end
60
+ end
@@ -0,0 +1,23 @@
1
+ require 'rubygems'
2
+ require 'mocha'
3
+
4
+ require 'boot'
5
+
6
+ require 'geokit'
7
+ require 'geokit-rails'
8
+
9
+
10
+ class GeokitTestCase < ActiveSupport::TestCase
11
+ begin
12
+ include ActiveRecord::TestFixtures
13
+ rescue NameError
14
+ puts "You appear to be using a pre-2.3 version of Rails. No need to include ActiveRecord::TestFixtures."
15
+ end
16
+
17
+ self.fixture_path = File.join(File.dirname(__FILE__), 'fixtures')
18
+ self.use_transactional_fixtures = true
19
+ self.use_instantiated_fixtures = false
20
+
21
+ fixtures :all
22
+
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-friends
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Ball
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-13 00:00:00 -07:00
13
+ date: 2009-12-09 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -170,7 +170,6 @@ files:
170
170
  - test/rails_root/db/migrate/20090426041056_create_countries.rb
171
171
  - test/rails_root/db/migrate/20090426041103_create_states.rb
172
172
  - test/rails_root/db/migrate/20090512013727_create_profiles.rb
173
- - test/rails_root/db/migrate/20090602041838_create_users.rb
174
173
  - test/rails_root/db/migrate/20090608073052_create_friends.rb
175
174
  - test/rails_root/db/migrate/20090730044139_add_comment_cache.rb
176
175
  - test/rails_root/features/step_definitions/webrat_steps.rb
@@ -407,20 +406,25 @@ test_files:
407
406
  - test/rails_root/config/environments/development.rb
408
407
  - test/rails_root/config/environments/production.rb
409
408
  - test/rails_root/config/environments/test.rb
409
+ - test/rails_root/config/initializers/geokit_config.rb
410
410
  - test/rails_root/config/initializers/inflections.rb
411
411
  - test/rails_root/config/initializers/mime_types.rb
412
412
  - test/rails_root/config/initializers/requires.rb
413
413
  - test/rails_root/config/initializers/session_store.rb
414
414
  - test/rails_root/config/routes.rb
415
415
  - test/rails_root/db/migrate/20090320174818_create_muck_permissions_and_roles.rb
416
+ - test/rails_root/db/migrate/20090327231918_create_users.rb
416
417
  - test/rails_root/db/migrate/20090402033319_add_muck_activities.rb
417
418
  - test/rails_root/db/migrate/20090402234137_create_languages.rb
418
419
  - test/rails_root/db/migrate/20090426041056_create_countries.rb
419
420
  - test/rails_root/db/migrate/20090426041103_create_states.rb
420
421
  - test/rails_root/db/migrate/20090512013727_create_profiles.rb
421
- - test/rails_root/db/migrate/20090602041838_create_users.rb
422
422
  - test/rails_root/db/migrate/20090608073052_create_friends.rb
423
423
  - test/rails_root/db/migrate/20090730044139_add_comment_cache.rb
424
+ - test/rails_root/db/migrate/20090818204527_add_activity_indexes.rb
425
+ - test/rails_root/db/migrate/20090819030523_add_attachable_to_activities.rb
426
+ - test/rails_root/db/migrate/20091124203137_add_location_to_profiles.rb
427
+ - test/rails_root/db/migrate/20091124205819_add_fields_to_profiles.rb
424
428
  - test/rails_root/features/step_definitions/webrat_steps.rb
425
429
  - test/rails_root/features/support/env.rb
426
430
  - test/rails_root/features/support/paths.rb
@@ -432,5 +436,30 @@ test_files:
432
436
  - test/rails_root/test/unit/friend_mailer_test.rb
433
437
  - test/rails_root/test/unit/friend_test.rb
434
438
  - test/rails_root/test/unit/user_test.rb
439
+ - test/rails_root/vendor/plugins/geokit-rails/init.rb
440
+ - test/rails_root/vendor/plugins/geokit-rails/install.rb
441
+ - test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/acts_as_mappable.rb
442
+ - test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/abstract.rb
443
+ - test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/mysql.rb
444
+ - test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/postgresql.rb
445
+ - test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/adapters/sqlserver.rb
446
+ - test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/defaults.rb
447
+ - test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/geocoder_control.rb
448
+ - test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails/ip_geocode_lookup.rb
449
+ - test/rails_root/vendor/plugins/geokit-rails/lib/geokit-rails.rb
450
+ - test/rails_root/vendor/plugins/geokit-rails/test/acts_as_mappable_test.rb
451
+ - test/rails_root/vendor/plugins/geokit-rails/test/boot.rb
452
+ - test/rails_root/vendor/plugins/geokit-rails/test/ip_geocode_lookup_test.rb
453
+ - test/rails_root/vendor/plugins/geokit-rails/test/models/company.rb
454
+ - test/rails_root/vendor/plugins/geokit-rails/test/models/custom_location.rb
455
+ - test/rails_root/vendor/plugins/geokit-rails/test/models/location.rb
456
+ - test/rails_root/vendor/plugins/geokit-rails/test/models/mock_address.rb
457
+ - test/rails_root/vendor/plugins/geokit-rails/test/models/mock_family.rb
458
+ - test/rails_root/vendor/plugins/geokit-rails/test/models/mock_house.rb
459
+ - test/rails_root/vendor/plugins/geokit-rails/test/models/mock_organization.rb
460
+ - test/rails_root/vendor/plugins/geokit-rails/test/models/mock_person.rb
461
+ - test/rails_root/vendor/plugins/geokit-rails/test/models/store.rb
462
+ - test/rails_root/vendor/plugins/geokit-rails/test/schema.rb
463
+ - test/rails_root/vendor/plugins/geokit-rails/test/test_helper.rb
435
464
  - test/rails_root/vendor/plugins/ssl_requirement/lib/ssl_requirement.rb
436
465
  - test/rails_root/vendor/plugins/ssl_requirement/test/ssl_requirement_test.rb