Active 0.0.42 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.irbrc +21 -0
- data/.rspec +1 -0
- data/.rvmrc +2 -0
- data/Active.gemspec +28 -29
- data/Gemfile +4 -0
- data/History.txt +5 -2
- data/{README.txt → README.md} +4 -20
- data/Rakefile +11 -17
- data/lib/Active.rb +11 -79
- data/lib/active/activity.rb +7 -0
- data/lib/active/article.rb +7 -0
- data/lib/active/asset.rb +205 -0
- data/lib/active/errors.rb +9 -0
- data/lib/active/query.rb +225 -0
- data/lib/active/result.rb +7 -0
- data/lib/active/results.rb +6 -0
- data/lib/active/training.rb +7 -0
- data/lib/active/version.rb +3 -0
- data/lib/ext/hash_extensions.rb +8 -0
- data/spec/asset_spec.rb +47 -0
- data/spec/search_spec.rb +383 -432
- data/spec/spec_helper.rb +23 -2
- metadata +113 -116
- data/bin/Active +0 -7
- data/lib/.DS_Store +0 -0
- data/lib/services/.DS_Store +0 -0
- data/lib/services/IActivity.rb +0 -39
- data/lib/services/_ats.rb +0 -215
- data/lib/services/active_works.rb +0 -167
- data/lib/services/activity.rb +0 -512
- data/lib/services/address.rb +0 -17
- data/lib/services/ats.rb +0 -229
- data/lib/services/dto/user.rb +0 -9
- data/lib/services/gsa.rb +0 -205
- data/lib/services/reg_center.rb +0 -270
- data/lib/services/sanitize.rb +0 -108
- data/lib/services/search.rb +0 -494
- data/lib/services/validators.rb +0 -124
- data/rspec-tm +0 -1
- data/rvmrc +0 -1
- data/spec/.DS_Store +0 -0
- data/spec/Active_spec.rb +0 -28
- data/spec/activeworks_spec.rb +0 -60
- data/spec/activity_spec.rb +0 -421
- data/spec/ats_spec.rb +0 -106
- data/spec/benchmark/search_bench.rb +0 -55
- data/spec/custom_matchers_spec.rb +0 -27
- data/spec/gsa_spec.rb +0 -210
- data/spec/reg_spec.rb +0 -173
- data/spec/search_memcached_spec.rb +0 -42
- data/spec/validators_spec.rb +0 -19
- data/test/test_Active.rb +0 -0
- data/version.txt +0 -1
data/lib/services/validators.rb
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
module Active
|
2
|
-
module Services
|
3
|
-
class Validators
|
4
|
-
|
5
|
-
def self.email arg
|
6
|
-
if (arg =~ /((\w|-)+(\.\w+)?)+@\w+\.\w+/) == nil
|
7
|
-
# if (arg =~ /^(\w|\.|-)+?@(\w|-)+?\.\w{2,4}($|\.\w{2,4})$/) == nil
|
8
|
-
return false
|
9
|
-
else
|
10
|
-
return true
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# return true or false
|
15
|
-
# very short check for 5 consecutive digits, no leading or trailing whitespace.
|
16
|
-
def self.zip(arg)
|
17
|
-
# if (arg =~ /\be(\w*)/) != -1
|
18
|
-
# true
|
19
|
-
# else
|
20
|
-
# false
|
21
|
-
# end
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.state
|
25
|
-
true
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.city
|
29
|
-
false
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.address
|
33
|
-
false
|
34
|
-
end
|
35
|
-
|
36
|
-
STATES = [
|
37
|
-
[ "Alabama", "AL" ],
|
38
|
-
[ "Alaska", "AK" ],
|
39
|
-
[ "Arizona", "AZ" ],
|
40
|
-
[ "Arkansas", "AR" ],
|
41
|
-
[ "California", "CA" ],
|
42
|
-
[ "Colorado", "CO" ],
|
43
|
-
[ "Connecticut", "CT" ],
|
44
|
-
[ "Delaware", "DE" ],
|
45
|
-
[ "District Of Columbia", "DC" ],
|
46
|
-
[ "Florida", "FL" ],
|
47
|
-
[ "Georgia", "GA" ],
|
48
|
-
[ "Hawaii", "HI" ],
|
49
|
-
[ "Idaho", "ID" ],
|
50
|
-
[ "Illinois", "IL" ],
|
51
|
-
[ "Indiana", "IN" ],
|
52
|
-
[ "Iowa", "IA" ],
|
53
|
-
[ "Kansas", "KS" ],
|
54
|
-
[ "Kentucky", "KY" ],
|
55
|
-
[ "Louisiana", "LA" ],
|
56
|
-
[ "Maine", "ME" ],
|
57
|
-
[ "Maryland", "MD" ],
|
58
|
-
[ "Massachusetts", "MA" ],
|
59
|
-
[ "Michigan", "MI" ],
|
60
|
-
[ "Minnesota", "MN" ],
|
61
|
-
[ "Mississippi", "MS" ],
|
62
|
-
[ "Missouri", "MO" ],
|
63
|
-
[ "Montana", "MT" ],
|
64
|
-
[ "Nebraska", "NE" ],
|
65
|
-
[ "Nevada", "NV" ],
|
66
|
-
[ "New Hampshire", "NH" ],
|
67
|
-
[ "New Jersey", "NJ" ],
|
68
|
-
[ "New Mexico", "NM" ],
|
69
|
-
[ "New York", "NY" ],
|
70
|
-
[ "North Carolina", "NC" ],
|
71
|
-
[ "North Dakota", "ND" ],
|
72
|
-
[ "Ohio", "OH" ],
|
73
|
-
[ "Oklahoma", "OK" ],
|
74
|
-
[ "Oregon", "OR" ],
|
75
|
-
[ "Pennsylvania", "PA" ],
|
76
|
-
[ "Rhode Island", "RI" ],
|
77
|
-
[ "South Carolina", "SC" ],
|
78
|
-
[ "South Dakota", "SD" ],
|
79
|
-
[ "Tennessee", "TN" ],
|
80
|
-
[ "Texas", "TX" ],
|
81
|
-
[ "Utah", "UT" ],
|
82
|
-
[ "Vermont", "VT" ],
|
83
|
-
[ "Virginia", "VA" ],
|
84
|
-
[ "Washington", "WA" ],
|
85
|
-
[ "West Virginia", "WV" ],
|
86
|
-
[ "Wisconsin", "WI" ],
|
87
|
-
[ "Wyoming", "WY" ]
|
88
|
-
]
|
89
|
-
|
90
|
-
def self.full_name(abbr)
|
91
|
-
STATES.find do |i|
|
92
|
-
if i[1] == abbr.upcase
|
93
|
-
return i[0]
|
94
|
-
end
|
95
|
-
end
|
96
|
-
return nil
|
97
|
-
end
|
98
|
-
|
99
|
-
def self.valid_state(name)
|
100
|
-
return nil if name.nil?
|
101
|
-
STATES.find do |i|
|
102
|
-
if i[0].upcase==name.strip.upcase
|
103
|
-
return i[0]
|
104
|
-
elsif i[1] == name.upcase
|
105
|
-
return i[0]
|
106
|
-
end
|
107
|
-
end
|
108
|
-
return nil
|
109
|
-
end
|
110
|
-
|
111
|
-
# NO MODIFYING IN A VALIDATION CLASS
|
112
|
-
# !! clean zip
|
113
|
-
# (http://geekswithblogs.net/MainaD/archive/2007/12/03/117321.aspx)
|
114
|
-
def self.valid_zip(zip)
|
115
|
-
if zip!="00000" && zip.to_s.strip=~/(^\d{5}(-\d{4})?$)|(^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$)/
|
116
|
-
return zip.to_s.strip
|
117
|
-
else
|
118
|
-
return nil
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
end
|
124
|
-
end
|
data/rspec-tm
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--rspec-version 1.3.1
|
data/rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
|
data/spec/.DS_Store
DELETED
Binary file
|
data/spec/Active_spec.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# Require the spec helper relative to this file
|
2
|
-
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
3
|
-
require File.join(File.dirname(__FILE__), %w[custom_matchers_spec])
|
4
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services search])
|
5
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services activity])
|
6
|
-
include Active
|
7
|
-
include Active::Services
|
8
|
-
|
9
|
-
|
10
|
-
describe Active do
|
11
|
-
|
12
|
-
it "shouls set memcache" do
|
13
|
-
Active.CACHE.should be_nil
|
14
|
-
Active.memcache_host "localhost:11211"
|
15
|
-
Active.CACHE.should_not be_nil
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should have a working memcache" do
|
19
|
-
Active.memcache_host "localhost:11211"
|
20
|
-
Active.CACHE.set("active","rocks");
|
21
|
-
Active.CACHE.get("active").should eql("rocks")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should cache the data" do
|
25
|
-
Active.memcache_host "localhost:11211"
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
data/spec/activeworks_spec.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# Require the spec helper relative to this file
|
2
|
-
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
3
|
-
require File.join(File.dirname(__FILE__), %w[custom_matchers_spec])
|
4
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services search])
|
5
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services activity])
|
6
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services reg_center])
|
7
|
-
include Active::Services
|
8
|
-
|
9
|
-
describe ActiveWorks do
|
10
|
-
before(:each) do
|
11
|
-
@valid_id = "E-00072ZDN"
|
12
|
-
end
|
13
|
-
it "should set find by id" do
|
14
|
-
a = ActiveWorks.find_by_id(@valid_id)
|
15
|
-
a.data["id"].should == @valid_id
|
16
|
-
end
|
17
|
-
it "should have a nil user email" do
|
18
|
-
a = ActiveWorks.find_by_id(@valid_id)
|
19
|
-
a.user.email.should be_nil
|
20
|
-
end
|
21
|
-
it "should set the asset_type_id" do
|
22
|
-
ActiveWorks.find_by_id(@valid_id).asset_type_id.should_not be_nil
|
23
|
-
end
|
24
|
-
it "should thorw an ActiveWorksError if no record is found" do
|
25
|
-
lambda { ActiveWorks.find_by_id( "666" ) }.should raise_error(ActiveWorksError)
|
26
|
-
end
|
27
|
-
it "should get the API metadata" do
|
28
|
-
a = ActiveWorks.find_by_id(@valid_id)
|
29
|
-
a.data["eventDetailDto"].should_not be_nil
|
30
|
-
end
|
31
|
-
it "should have an address Hash" do
|
32
|
-
a = ActiveWorks.find_by_id(@valid_id)
|
33
|
-
a.address.should be_an_instance_of(HashWithIndifferentAccess)
|
34
|
-
end
|
35
|
-
it "should have a desc" do
|
36
|
-
a = ActiveWorks.find_by_id(@valid_id)
|
37
|
-
a.desc.should_not == ""
|
38
|
-
a.desc.should_not == nil
|
39
|
-
end
|
40
|
-
it "should cleanup desc" do
|
41
|
-
a = ActiveWorks.find_by_id(@valid_id)
|
42
|
-
puts a.desc
|
43
|
-
a.desc.should_not include('\"')
|
44
|
-
end
|
45
|
-
it "should have a title String" do
|
46
|
-
a = ActiveWorks.find_by_id(@valid_id)
|
47
|
-
a.title.should be_an_instance_of(String)
|
48
|
-
end
|
49
|
-
it "should have a start_date DateTime" do
|
50
|
-
a = ActiveWorks.find_by_id(@valid_id)
|
51
|
-
puts a.start_date
|
52
|
-
a.start_date.should be_an_instance_of(DateTime)
|
53
|
-
end
|
54
|
-
it "should have a start_time DateTime" do
|
55
|
-
a = ActiveWorks.find_by_id(@valid_id)
|
56
|
-
a.start_time.should be_an_instance_of(DateTime)
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
end
|
data/spec/activity_spec.rb
DELETED
@@ -1,421 +0,0 @@
|
|
1
|
-
# Require the spec helper relative to this file
|
2
|
-
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
3
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services search])
|
4
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services activity])
|
5
|
-
require File.join(File.dirname(__FILE__), %w[ .. lib services IActivity])
|
6
|
-
|
7
|
-
# No need to type Britify:: before each call
|
8
|
-
include Active::Services
|
9
|
-
|
10
|
-
describe Activity do
|
11
|
-
describe "Creating an activity from a GSA object" do
|
12
|
-
before(:each) do
|
13
|
-
@a = Activity.new( GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","language":"en","title":"2011 Rohto Ironman 70.3 California | Oceanside, California \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","summary":"","meta":{"eventDate":"2011-04-02T00:00:00-07:00","location":"Oceanside Harbor","tag":["event:10","Triathlon:10"],"eventLongitude":"-117.3586","endDate":"2011-04-02","locationName":"Oceanside Harbor","lastModifiedDateTime":"2010-09-30 06:16:05.107","splitMediaType":["Event","Ironman","Long Course"],"endTime":"0:00:00","city":"Oceanside","google-site-verification":"","startTime":"0:00:00","eventId":"1838902","description":"","longitude":"-117.3586","substitutionUrl":"1838902","sortDate":"2001-04-02","eventState":"California","eventLatitude":"33.19783","keywords":"Event","eventAddress":"1540 Harbor Drive North","dma":"San Diego","seourl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","country":"United States","category":"Activities","market":"San Diego","contactName":"World Triathlon Corporation","assetTypeId":"3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6","eventZip":"92054","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"33.19783","startDate":"2011-04-02","state":"California","mediaType":["Event","Event\\Ironman","Event\\Long Course"],"estParticipants":"2500","assetId":["77ACABBD-BA83-4C78-925D-CE49DEDDF20C","77acabbd-ba83-4c78-925d-ce49deddf20c"],"participationCriteria":"All","onlineDonationAvailable":"0","assetName":["2011 Rohto Ironman 70.3 California","2011 Rohto Ironman 70.3 California"],"zip":"92054","eventURL":"http://www.ironmancalifornia.com/","contactPhone":"813-868-5940","contactEmail":"california70.3@ironman.com","onlineMembershipAvailable":"0","trackbackurl":"http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011","onlineRegistrationAvailable":"true","image1":"http://www.active.com/images/events/hotrace.gif","lastModifiedDate":"2010-09-30","channel":"Triathlon"}}')) )
|
14
|
-
@ats_activity = Activity.new(ATS.new( {"destinationID"=>"", "assetId"=>"EEBC04D9-EA80-46C6-B9DD-6EBF49F8678F", "substitutionUrl"=>"1875345", "city"=>"San Francisco", "contactName"=>"Pete Berg", "trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1875345&assetId=EEBC04D9-EA80-46C6-B9DD-6EBF49F8678F", :asset_id=>"EEBC04D9-EA80-46C6-B9DD-6EBF49F8678F", "category"=>"Activities", "zip"=>"94111", "userCommentText"=>nil, "location"=>"San Francisco metro area", "latitude"=>"37.7983181", :asset_type_name=>"Active.com Event Registration", "searchWeight"=>"1", "country"=>"United States", "participationCriteria"=>"Adult,Family,Kids,Men,Women", "dma"=>"San Francisco - Oakland - San Jose", :asset_name=>"URBAN HUNT: San Francisco", :asset_type_id=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "isSearchable"=>"true", :xmlns=>"http://api.asset.services.active.com", :url=>"http://www.active.com/page/Event_Details.htm?event_id=1875345", "row"=>"1", "image1"=>nil, "startDate"=>"2010-10-16", "contactPhone"=>"607-222-9845", "onlineDonationAvailable"=>"0", "avgUserRating"=>nil, "market"=>"San Francisco - Oakland - San Jose", :substitution_url=>"1875345", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "assetName"=>"URBAN HUNT: San Francisco", "channel"=>["More Sports\\Adventure Racing", "Running"], "seourl"=>"http://www.active.com/running/san-francisco-ca/urban-hunt-san-francisco-2010", "mediaType"=>["Event", "Event\\5 mile", "=difficulty:Beginner", "=difficulty:Intermediate"], "startTime"=>"11:00:00", "endTime"=>"11:00:00", "contactEmail"=>"info@realityrush.com", "eventResults"=>nil, "longitude"=>"-122.4000032", "endDate"=>"2010-10-16", "onlineRegistrationAvailable"=>"false", "onlineMembershipAvailable"=>"0", "state"=>"California", "estParticipants"=>"100", "eventURL"=>"http://www.realityrush.com/events/urban-hunt-san-francisco-oct-16th-2010/"}))
|
15
|
-
end
|
16
|
-
it "should have online registration" do
|
17
|
-
@a.online_registration.should be_true
|
18
|
-
end
|
19
|
-
it "should have asset ids" do
|
20
|
-
@a.asset_id.should_not be_nil
|
21
|
-
@a.asset_id.should eql("77ACABBD-BA83-4C78-925D-CE49DEDDF20C")
|
22
|
-
@a.asset_type_id.should_not be_nil
|
23
|
-
@a.asset_type_id.should eql("3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6")
|
24
|
-
end
|
25
|
-
it "should have a title" do
|
26
|
-
g = GSA.new(JSON.parse('{"title":"2011 Rohto Ironman 70.3 California\u003cb\u003e...\u003c/b\u003e | Oceanside, California \u003cb\u003e...\u003c/b\u003e"}'))
|
27
|
-
g.source.should eql(:gsa)
|
28
|
-
g.title.should eql("2011 Rohto Ironman 70.3 California")
|
29
|
-
a = Activity.new( g )
|
30
|
-
a.gsa.should_not be_nil
|
31
|
-
a.title.should eql("2011 Rohto Ironman 70.3 California")
|
32
|
-
end
|
33
|
-
# start date
|
34
|
-
it "should have a valid start date" do
|
35
|
-
@a.start_date.should_not be_nil
|
36
|
-
@a.start_date.should be_an_instance_of(DateTime)
|
37
|
-
end
|
38
|
-
it "should have nil is no date" do
|
39
|
-
a = Activity.new( GSA.new(JSON.parse('{"title":"Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e"}')) )
|
40
|
-
a.start_date.should be_nil
|
41
|
-
end
|
42
|
-
# end date
|
43
|
-
it "should have a valid end date" do
|
44
|
-
@a.end_date.should_not be_nil
|
45
|
-
@a.end_date.should be_an_instance_of(DateTime)
|
46
|
-
end
|
47
|
-
it "should have nil is no date" do
|
48
|
-
a = Activity.new( GSA.new(JSON.parse('{"title":"Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e"}')) )
|
49
|
-
a.end_date.should be_nil
|
50
|
-
end
|
51
|
-
# start time
|
52
|
-
it "should have a valid start date" do
|
53
|
-
@a.start_time.should_not be_nil
|
54
|
-
@a.start_time.should be_an_instance_of(DateTime)
|
55
|
-
end
|
56
|
-
it "should have nil is no date" do
|
57
|
-
g = GSA.new(JSON.parse('{"title":"Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e"}'))
|
58
|
-
g.start_time.should be_nil
|
59
|
-
end
|
60
|
-
# end time
|
61
|
-
it "should have a valid end date" do
|
62
|
-
@a.start_time.should_not be_nil
|
63
|
-
@a.start_time.should be_an_instance_of(DateTime)
|
64
|
-
end
|
65
|
-
it "should have nil is no date" do
|
66
|
-
g = GSA.new(JSON.parse('{"title":"Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e"}'))
|
67
|
-
g.start_time.should be_nil
|
68
|
-
end
|
69
|
-
# asset_id
|
70
|
-
it "should have nil is no date" do
|
71
|
-
g = Activity.new GSA.new(JSON.parse('{"title":"Calabasas Classic 2010 - 5k \u003cb\u003e10k\u003c/b\u003e Runs | Calabasas, California 91302 \u003cb\u003e...\u003c/b\u003e"}'))
|
72
|
-
g.start_time.should be_nil
|
73
|
-
end
|
74
|
-
it "should have an asset_id" do
|
75
|
-
Activity.new(GSA.new).asset_id.should be_nil
|
76
|
-
@a.asset_id.should_not be_nil
|
77
|
-
end
|
78
|
-
it "should have an asset_type_id" do
|
79
|
-
Activity.new(GSA.new).asset_type_id.should be_nil
|
80
|
-
@a.asset_type_id.should_not be_nil
|
81
|
-
end
|
82
|
-
#address
|
83
|
-
it "should have a full address" do
|
84
|
-
g = Activity.new (GSA.new(JSON.parse('{"title":"Calabasas", "meta":{"location":"Oceanside Harbor","eventLongitude":"-117.3586","locationName":"Oceanside Harbor","eventAddress":"1540 Harbor Drive North", "city":"San Diego", "eventState":"CA", "eventZip":"92121", "latitude":"-22", "longitude":"222", "country":"USA" }}')) )
|
85
|
-
g.address.should_not be_nil
|
86
|
-
g.address[:name].should eql("Oceanside Harbor")
|
87
|
-
g.address[:address].should eql("1540 Harbor Drive North")
|
88
|
-
g.address[:city].should eql("San Diego")
|
89
|
-
g.address[:state].should eql("CA")
|
90
|
-
g.address[:zip].should eql("92121")
|
91
|
-
g.address[:country].should eql("USA")
|
92
|
-
g.address[:lat].should eql("-22")
|
93
|
-
g.address[:lng].should eql("222")
|
94
|
-
end
|
95
|
-
it "should have a partial address that it's full data doesn't live in WORKS or REGCENTER" do
|
96
|
-
g = Activity.new(GSA.new(JSON.parse('{"language":"en", "title":"Zumba Punch Card (Adult) - Oct. (5) | Vista, CA, 92084 |", "url":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "escapedUrl":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "meta":{"city":"Vista", "assetId":"3ae995d9-5c16-4176-b44e-fa0577644ca4", "substitutionUrl":"vistarecreation/registrationmain.sdi?source=showAsset.sdi&activity_id=4900", "trackbackurl":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "onlineRegistrationAvailable":"false", "zip":"92084", "sortDate":"2000-10-02", "category":"Activities", "latitude":"33.2000368", "dma":"San Diego", "lastModifiedDate":"2010-09-29", "tags":"2348.321", "lastModifiedDateTime":"2010-09-29 16:46:43.33", "country":"United States of America", "startDate":"2010-10-02", "assetName":"Zumba Punch Card (Adult) - Oct. (5)", "summary":"People of all ages are falling in love with Zumba, one of the fastest growing dance-based fitness crazes in the country. With Zumbas easy-to-follow dance moves you receive body beautifying benefits while enjoying Latin rhythms including Salsa, Meringue, Cumbia, Reggaeton, even belly dance and hip-hop. Zumba is ", "description":"", "seourl":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "channel":"Community Services", "splitMediaType":"Class", "mediaType":"Class", "longitude":"-117.2425355", "UpdateDateTime":"8/20/2008 9:03:50 AM", "assetTypeId":"FB27C928-54DB-4ECD-B42F-482FC3C8681F", "state":"California", "keywords":""}, "summary":""}')))
|
97
|
-
g.address[:name].should be_nil # eql("City of Vista Recreation")
|
98
|
-
g.address[:address].should be_nil # eql("200 Civic Center Dr.")
|
99
|
-
g.address[:city].should eql("Vista")
|
100
|
-
g.address[:state].should eql("California")
|
101
|
-
g.address[:zip].should eql("92084")
|
102
|
-
g.address[:country].should eql("United States of America")
|
103
|
-
g.address[:lat].should eql("33.2000368")
|
104
|
-
g.address[:lng].should eql("-117.2425355")
|
105
|
-
end
|
106
|
-
it "should have an address from this hash with null name and address" do
|
107
|
-
g = Activity.new(GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/cycling/san-francisco-ca/california-wine-country-bike-tours-in-october-2010","language":"en","title":"2010 California Wine Country Bike Tours in October | San \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/cycling/san-francisco-ca/california-wine-country-bike-tours-in-october-2010","summary":"","meta":{"startDate":"2010-10-10","eventDate":"2010-10-10T00:00:00-07:00","state":"California","endDate":"2010-10-22","eventLongitude":"-122.4200000","lastModifiedDateTime":"2010-08-26 02:15:54.36","splitMediaType":"Event","endTime":"0:00:00","mediaType":"Event","city":"San Francisco","google-site-verification":"","estParticipants":"2000","startTime":"0:00:00","assetId":["81A4A089-CAB5-4293-BFBF-87C74A1C6370","81a4a089-cab5-4293-bfbf-87c74a1c6370"],"eventId":"1889827","participationCriteria":"All","description":"","longitude":"-122.4200000","onlineDonationAvailable":"0","substitutionUrl":"1889827","assetName":["2010 California Wine Country Bike Tours in October","2010 California Wine Country Bike Tours in October"],"eventURL":"http://www.trektravel.com/contentpage.cfm?ID\u003d703","zip":"94101","contactPhone":"866-464-8735","eventLatitude":"37.7800000","eventState":"California","sortDate":"2000-10-10","keywords":"Event","onlineMembershipAvailable":"0","dma":"San Francisco - Oakland - San Jose","trackbackurl":"http://www.active.com/cycling/san-francisco-ca/california-wine-country-bike-tours-in-october-2010","seourl":"http://www.active.com/cycling/san-francisco-ca/california-wine-country-bike-tours-in-october-2010","country":"United States","onlineRegistrationAvailable":"0","category":"Activities","market":"San Francisco - Oakland - San Jose","assetTypeId":"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate":"2010-08-26","eventZip":"94101","UpdateDateTime":"8/18/2010 10:16:26 AM","latitude":"37.7800000","channel":"Cycling"}}')))
|
108
|
-
g.address[:name].should be_nil
|
109
|
-
g.address[:address].should be_nil
|
110
|
-
g.address[:city].should eql("San Francisco")
|
111
|
-
g.address[:state].should eql("California")
|
112
|
-
g.address[:zip].should eql("94101")
|
113
|
-
g.address[:country].should eql("United States")
|
114
|
-
g.address[:lat].should eql("37.7800000")
|
115
|
-
g.address[:lng].should eql("-122.4200000")
|
116
|
-
end
|
117
|
-
|
118
|
-
# TODO FIND OUT WHERE THIS DATA COMES FROM AND GET IT WORKING
|
119
|
-
# it "should have a partial address that it's full data doesn't live in WORKS or REGCENTER" do
|
120
|
-
# g = Activity.new(GSA.new(JSON.parse('{"language":"en", "title":"Zumba Punch Card (Adult) - Oct. (5) | Vista, CA, 92084 |", "url":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "escapedUrl":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "meta":{"city":"Vista", "assetId":"3ae995d9-5c16-4176-b44e-fa0577644ca4", "substitutionUrl":"vistarecreation/registrationmain.sdi?source=showAsset.sdi&activity_id=4900", "trackbackurl":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "onlineRegistrationAvailable":"false", "zip":"92084", "sortDate":"2000-10-02", "category":"Activities", "latitude":"33.2000368", "dma":"San Diego", "lastModifiedDate":"2010-09-29", "tags":"2348.321", "lastModifiedDateTime":"2010-09-29 16:46:43.33", "country":"United States of America", "startDate":"2010-10-02", "assetName":"Zumba Punch Card (Adult) - Oct. (5)", "summary":"People of all ages are falling in love with Zumba, one of the fastest growing dance-based fitness crazes in the country. With Zumbas easy-to-follow dance moves you receive body beautifying benefits while enjoying Latin rhythms including Salsa, Meringue, Cumbia, Reggaeton, even belly dance and hip-hop. Zumba is ", "description":"", "seourl":"http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010", "channel":"Community Services", "splitMediaType":"Class", "mediaType":"Class", "longitude":"-117.2425355", "UpdateDateTime":"8/20/2008 9:03:50 AM", "assetTypeId":"FB27C928-54DB-4ECD-B42F-482FC3C8681F", "state":"California", "keywords":""}, "summary":""}')))
|
121
|
-
# g.address[:name].should eql("City of Vista Recreation")
|
122
|
-
# g.address[:address].should eql("200 Civic Center Dr.")
|
123
|
-
# g.address[:city].should eql("Vista")
|
124
|
-
# g.address[:state].should eql("California")
|
125
|
-
# g.address[:zip].should eql("92084")
|
126
|
-
# g.address[:country].should eql("United States of America")
|
127
|
-
# g.address[:lat].should eql("33.2000368")
|
128
|
-
# g.address[:lng].should eql("-117.2425355")
|
129
|
-
# end
|
130
|
-
|
131
|
-
# USER
|
132
|
-
it "should have a nil user email" do
|
133
|
-
g = Activity.new(GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","language":"en","title":"Seismic Challenge 3.0 | San Francisco, California 94101 \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","summary":"","meta":{"startDate":"2010-10-02","eventDate":"2010-10-02T00:00:00-07:00","tag":"event:10","state":"California","eventLongitude":"-122.42","endDate":"2010-10-03","lastModifiedDateTime":"2010-10-04 03:08:51.65","splitMediaType":"Event","locationName":"San Francisco Bay","endTime":"0:00:00","mediaType":"Event","city":"San Francisco","google-site-verification":"","estParticipants":"2000","startTime":"0:00:00","assetId":["35A99FCB-E238-4D78-9205-96179F827CB0","35a99fcb-e238-4d78-9205-96179f827cb0"],"eventId":"1883181","participationCriteria":"All","description":"","longitude":"-122.42","onlineDonationAvailable":"0","substitutionUrl":"1883181","assetName":["Seismic Challenge 3.0","Seismic Challenge 3.0"],"eventURL":"http://greaterthanone.org/events/seismic-challenge/","zip":"94101","contactPhone":"415-487-3053","sortDate":"2000-10-02","eventState":"California","eventLatitude":"37.78","keywords":"Event","onlineMembershipAvailable":"0","dma":"San Francisco - Oakland - San Jose","trackbackurl":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","seourl":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","country":"United States","onlineRegistrationAvailable":"false","category":"Activities","market":"San Francisco - Oakland - San Jose","assetTypeId":"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate":"2010-10-04","eventZip":"94101","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"37.78","channel":"Cycling"}}')))
|
134
|
-
g.user.email.should be_nil
|
135
|
-
end
|
136
|
-
it "should have a valid user email" do
|
137
|
-
g = Activity.new(GSA.new(JSON.parse('{"escapedUrl":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","language":"en","title":"Seismic Challenge 3.0 | San Francisco, California 94101 \u003cb\u003e...\u003c/b\u003e","url":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","summary":"","meta":{"startDate":"2010-10-02","eventDate":"2010-10-02T00:00:00-07:00","tag":"event:10","state":"California","eventLongitude":"-122.42","endDate":"2010-10-03","lastModifiedDateTime":"2010-10-04 03:08:51.65","splitMediaType":"Event","locationName":"San Francisco Bay","endTime":"0:00:00","mediaType":"Event","city":"San Francisco","google-site-verification":"","estParticipants":"2000","startTime":"0:00:00","assetId":["35A99FCB-E238-4D78-9205-96179F827CB0","35a99fcb-e238-4d78-9205-96179f827cb0"],"eventId":"1883181","participationCriteria":"All","description":"","longitude":"-122.42","onlineDonationAvailable":"0","substitutionUrl":"1883181","assetName":["Seismic Challenge 3.0","Seismic Challenge 3.0"],"eventURL":"http://greaterthanone.org/events/seismic-challenge/","zip":"94101","contactPhone":"415-487-3053","sortDate":"2000-10-02","eventState":"California","eventLatitude":"37.78","keywords":"Event","contactEmail":"eventinfo@sfaf.org","onlineMembershipAvailable":"0","dma":"San Francisco - Oakland - San Jose","trackbackurl":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","seourl":"http://www.active.com/cycling/san-francisco-ca/seismic-challenge-30-2010","country":"United States","onlineRegistrationAvailable":"false","category":"Activities","market":"San Francisco - Oakland - San Jose","assetTypeId":"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65","lastModifiedDate":"2010-10-04","eventZip":"94101","UpdateDateTime":"9/22/2010 11:46:24 AM","latitude":"37.78","channel":"Cycling"}}')))
|
138
|
-
g.user.email.should eql("eventinfo@sfaf.org")
|
139
|
-
end
|
140
|
-
|
141
|
-
# title
|
142
|
-
it "should have a gsa title" do
|
143
|
-
@a.title.should eql("2011 Rohto Ironman 70.3 California")
|
144
|
-
end
|
145
|
-
it "should have a primary title" do
|
146
|
-
@a.primary_loaded?.should eql(false)
|
147
|
-
@a._title.should eql("2011 Rohto Ironman 70.3 California")
|
148
|
-
@a.primary_loaded?.should eql(true)
|
149
|
-
end
|
150
|
-
it "should have a gsa url" do
|
151
|
-
@a.url.should eql("http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011")
|
152
|
-
end
|
153
|
-
it "should have an ats url" do
|
154
|
-
@a.ats_loaded?.should eql(false)
|
155
|
-
@a._url.should eql("http://www.active.com/triathlon/oceanside-ca/rohto-ironman-703-california-2011")
|
156
|
-
@a.ats_loaded?.should eql(true)
|
157
|
-
end
|
158
|
-
it "should have a gsa categories" do
|
159
|
-
@a.categories.should eql(["Triathlon"])
|
160
|
-
end
|
161
|
-
it "should have an primary source categories" do
|
162
|
-
@a.primary_loaded?.should eql(false)
|
163
|
-
@a._categories.should eql(["Triathlon"])
|
164
|
-
@a.primary_loaded?.should eql(true)
|
165
|
-
end
|
166
|
-
it "should have a gsa address" do
|
167
|
-
@a.primary_loaded?.should eql(false)
|
168
|
-
@a.address["address"].should eql("1540 Harbor Drive North")
|
169
|
-
@a.primary_loaded?.should eql(false)
|
170
|
-
end
|
171
|
-
it "should have an primary source address" do
|
172
|
-
@a.primary_loaded?.should eql(false)
|
173
|
-
@a._address["address"].should eql("1540 Harbor Drive North")
|
174
|
-
@a.primary_loaded?.should eql(true)
|
175
|
-
end
|
176
|
-
it "should have a gsa start_date" do
|
177
|
-
@a.primary_loaded?.should eql(false)
|
178
|
-
@a.start_date.should be_an_instance_of(DateTime)
|
179
|
-
@a.primary_loaded?.should eql(false)
|
180
|
-
end
|
181
|
-
it "should have an primary source start_date" do
|
182
|
-
@a.primary_loaded?.should eql(false)
|
183
|
-
@a._start_date.should be_an_instance_of(DateTime)
|
184
|
-
@a.primary_loaded?.should eql(true)
|
185
|
-
end
|
186
|
-
it "should have a gsa start_time" do
|
187
|
-
@a.primary_loaded?.should eql(false)
|
188
|
-
@a.start_time.should be_an_instance_of(DateTime)
|
189
|
-
@a.primary_loaded?.should eql(false)
|
190
|
-
end
|
191
|
-
it "should have an primary source start_time" do
|
192
|
-
@a.primary_loaded?.should eql(false)
|
193
|
-
@a._start_time.should be_an_instance_of(DateTime)
|
194
|
-
@a.primary_loaded?.should eql(true)
|
195
|
-
end
|
196
|
-
|
197
|
-
it "should have a gsa end_date" do
|
198
|
-
@a.primary_loaded?.should eql(false)
|
199
|
-
@a.end_date.should be_an_instance_of(DateTime)
|
200
|
-
@a.primary_loaded?.should eql(false)
|
201
|
-
end
|
202
|
-
it "should have an primary source end_date" do
|
203
|
-
@a.primary_loaded?.should eql(false)
|
204
|
-
@a._end_date.should be_an_instance_of(DateTime)
|
205
|
-
@a.primary_loaded?.should eql(true)
|
206
|
-
end
|
207
|
-
|
208
|
-
it "should have a gsa end_time" do
|
209
|
-
@a.primary_loaded?.should eql(false)
|
210
|
-
@a.end_time.should be_an_instance_of(DateTime)
|
211
|
-
@a.primary_loaded?.should eql(false)
|
212
|
-
end
|
213
|
-
it "should have an primary source end_time" do
|
214
|
-
@a.primary_loaded?.should eql(false)
|
215
|
-
@a._end_time.should be_an_instance_of(DateTime)
|
216
|
-
@a.primary_loaded?.should eql(true)
|
217
|
-
end
|
218
|
-
|
219
|
-
it "should have a gsa category" do
|
220
|
-
@a.primary_loaded?.should eql(false)
|
221
|
-
@a.category.should eql("Triathlon")
|
222
|
-
@a.primary_loaded?.should eql(false)
|
223
|
-
end
|
224
|
-
it "should have an ats category" do
|
225
|
-
ats = Activity.new(ATS.find_by_id("77acabbd-ba83-4c78-925d-ce49deddf20c"))
|
226
|
-
ats.gsa_loaded?.should eql(false)
|
227
|
-
ats.category.should eql("Triathlon")
|
228
|
-
ats.primary_loaded?.should eql(false)
|
229
|
-
end
|
230
|
-
it "should have an primary source category" do
|
231
|
-
@a.primary_loaded?.should eql(false)
|
232
|
-
@a._category.should eql("Triathlon")
|
233
|
-
@a.primary_loaded?.should eql(true)
|
234
|
-
end
|
235
|
-
|
236
|
-
it "should have a gsa desc" do
|
237
|
-
@a.primary_loaded?.should eql(false)
|
238
|
-
@a.desc.should eql("")
|
239
|
-
@a.primary_loaded?.should eql(false)
|
240
|
-
end
|
241
|
-
it "should have an primary source desc" do
|
242
|
-
@a.primary_loaded?.should eql(false)
|
243
|
-
@a._desc.should_not eql("")
|
244
|
-
@a.primary_loaded?.should eql(true)
|
245
|
-
end
|
246
|
-
|
247
|
-
it "should have a gsa asset_id" do
|
248
|
-
@a.primary_loaded?.should eql(false)
|
249
|
-
@a.asset_id.should eql("77ACABBD-BA83-4C78-925D-CE49DEDDF20C")
|
250
|
-
@a.primary_loaded?.should eql(false)
|
251
|
-
end
|
252
|
-
it "should have an primary source asset_id" do
|
253
|
-
@a.primary_loaded?.should eql(false)
|
254
|
-
@a._asset_id.should eql("77acabbd-ba83-4c78-925d-ce49deddf20c")
|
255
|
-
@a.primary_loaded?.should eql(true)
|
256
|
-
end
|
257
|
-
|
258
|
-
it "should have a gsa asset_type_id" do
|
259
|
-
@a.primary_loaded?.should eql(false)
|
260
|
-
@a.asset_type_id.should eql("3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6")
|
261
|
-
@a.primary_loaded?.should eql(false)
|
262
|
-
end
|
263
|
-
it "should have an primary source asset_type_id" do
|
264
|
-
@a.primary_loaded?.should eql(false)
|
265
|
-
@a._asset_type_id.should eql("EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65")
|
266
|
-
@a.primary_loaded?.should eql(true)
|
267
|
-
end
|
268
|
-
it "should find by asset_id" do
|
269
|
-
@a = Activity.find({:asset_id=>"3292945B-08DE-41E5-BF6E-95ED5E59E800"})
|
270
|
-
@a.primary_loaded?.should eql(false)
|
271
|
-
@a._asset_type_id.should eql("EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65")
|
272
|
-
@a.primary_loaded?.should eql(true)
|
273
|
-
end
|
274
|
-
it "should find by substitutionUrl and asset_type_id" do
|
275
|
-
@a = Activity.find({:substitutionUrl=>"1877935", :asset_type_id=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65"})
|
276
|
-
@a.primary_loaded?.should eql(true)
|
277
|
-
@a.gsa_loaded?.should eql(false)
|
278
|
-
@a.ats_loaded?.should eql(false)
|
279
|
-
@a._url.should eql("http://www.active.com/not-specified-recware-activities/antioch-ca/young-rembrandts-drawing-612-yrs-2010")
|
280
|
-
@a.ats_loaded?.should eql(true)
|
281
|
-
end
|
282
|
-
|
283
|
-
it "should load url from ats and _title from primary" do
|
284
|
-
@ats_activity.url.should eql("http://www.active.com/running/san-francisco-ca/urban-hunt-san-francisco-2010")
|
285
|
-
@ats_activity.primary_loaded?.should eql(false)
|
286
|
-
@ats_activity._title.should eql("URBAN HUNT: San Francisco")
|
287
|
-
@ats_activity.primary_loaded?.should eql(true)
|
288
|
-
end
|
289
|
-
|
290
|
-
it "should have an ats title" do
|
291
|
-
@ats_activity.primary_loaded?.should eql(false)
|
292
|
-
@ats_activity.title.should eql( "URBAN HUNT: San Francisco")
|
293
|
-
@ats_activity.primary_loaded?.should eql(false)
|
294
|
-
end
|
295
|
-
it "should have a primary title" do
|
296
|
-
@ats_activity.primary_loaded?.should eql(false)
|
297
|
-
@ats_activity._title.should eql( "URBAN HUNT: San Francisco")
|
298
|
-
@ats_activity.primary_loaded?.should eql(true)
|
299
|
-
end
|
300
|
-
|
301
|
-
it "should have an ats categories" do
|
302
|
-
@ats_activity.primary_loaded?.should eql(false)
|
303
|
-
@ats_activity.categories.should eql(["Adventure Racing", "Running"])
|
304
|
-
@ats_activity.primary_loaded?.should eql(false)
|
305
|
-
end
|
306
|
-
it "should have a primary categories" do
|
307
|
-
@ats_activity.primary_loaded?.should eql(false)
|
308
|
-
@ats_activity._categories.should eql( ["Running", "Adventure Racing"])
|
309
|
-
@ats_activity.primary_loaded?.should eql(true)
|
310
|
-
end
|
311
|
-
|
312
|
-
it "should have an ats address" do
|
313
|
-
@ats_activity.primary_loaded?.should eql(false)
|
314
|
-
@ats_activity.address["city"].should eql("San Francisco")
|
315
|
-
@ats_activity.primary_loaded?.should eql(false)
|
316
|
-
end
|
317
|
-
it "should have a primary address" do
|
318
|
-
@ats_activity.primary_loaded?.should eql(false)
|
319
|
-
# puts @ats_activity._address.inspect
|
320
|
-
# puts @ats_activity.primary_source.data.inspect
|
321
|
-
@ats_activity._address["address"].should eql( "1 Embarcadero Center, San Francisco, CA 94111")
|
322
|
-
@ats_activity.primary_loaded?.should eql(true)
|
323
|
-
end
|
324
|
-
|
325
|
-
|
326
|
-
it "should have a ats start_date" do
|
327
|
-
@ats_activity.primary_loaded?.should eql(false)
|
328
|
-
@ats_activity.start_date.should be_an_instance_of(DateTime)
|
329
|
-
@ats_activity.primary_loaded?.should eql(false)
|
330
|
-
end
|
331
|
-
it "should have an primary source start_date" do
|
332
|
-
@ats_activity.primary_loaded?.should eql(false)
|
333
|
-
@ats_activity._start_date.should be_an_instance_of(DateTime)
|
334
|
-
@ats_activity.primary_loaded?.should eql(true)
|
335
|
-
end
|
336
|
-
it "should have a ats start_time" do
|
337
|
-
@ats_activity.primary_loaded?.should eql(false)
|
338
|
-
@ats_activity.start_time.should be_an_instance_of(DateTime)
|
339
|
-
@ats_activity.primary_loaded?.should eql(false)
|
340
|
-
end
|
341
|
-
it "should have an primary source start_time" do
|
342
|
-
@ats_activity.primary_loaded?.should eql(false)
|
343
|
-
@ats_activity._start_time.should be_an_instance_of(DateTime)
|
344
|
-
@ats_activity.primary_loaded?.should eql(true)
|
345
|
-
end
|
346
|
-
|
347
|
-
it "should have a ats end_date" do
|
348
|
-
@ats_activity.primary_loaded?.should eql(false)
|
349
|
-
@ats_activity.end_date.should be_an_instance_of(DateTime)
|
350
|
-
@ats_activity.primary_loaded?.should eql(false)
|
351
|
-
end
|
352
|
-
it "should have an primary source end_date" do
|
353
|
-
@ats_activity.primary_loaded?.should eql(false)
|
354
|
-
@ats_activity._end_date.should be_an_instance_of(DateTime)
|
355
|
-
@ats_activity.primary_loaded?.should eql(true)
|
356
|
-
end
|
357
|
-
|
358
|
-
it "should have a ats end_time" do
|
359
|
-
@ats_activity.primary_loaded?.should eql(false)
|
360
|
-
@ats_activity.end_time.should be_an_instance_of(DateTime)
|
361
|
-
@ats_activity.primary_loaded?.should eql(false)
|
362
|
-
end
|
363
|
-
it "should have an primary source end_time" do
|
364
|
-
@ats_activity.primary_loaded?.should eql(false)
|
365
|
-
@ats_activity._end_time.should be_an_instance_of(DateTime)
|
366
|
-
@ats_activity.primary_loaded?.should eql(true)
|
367
|
-
end
|
368
|
-
|
369
|
-
it "should have a ats category" do
|
370
|
-
@ats_activity.primary_loaded?.should eql(false)
|
371
|
-
@ats_activity.category.should eql("Adventure Racing")
|
372
|
-
@ats_activity.primary_loaded?.should eql(false)
|
373
|
-
end
|
374
|
-
|
375
|
-
it "should have a primay category" do
|
376
|
-
@ats_activity.primary_loaded?.should eql(false)
|
377
|
-
@ats_activity._category.should eql("Running")
|
378
|
-
@ats_activity.primary_loaded?.should eql(true)
|
379
|
-
end
|
380
|
-
|
381
|
-
# SHOULD DESC be null or empty
|
382
|
-
it "should have a ats desc" do
|
383
|
-
@ats_activity.primary_loaded?.should eql(false)
|
384
|
-
@ats_activity.desc.should eql("")
|
385
|
-
@ats_activity.primary_loaded?.should eql(false)
|
386
|
-
end
|
387
|
-
it "should have an primary source desc" do
|
388
|
-
@ats_activity.primary_loaded?.should eql(false)
|
389
|
-
@ats_activity._desc.should_not eql("")
|
390
|
-
# puts @ats_activity._desc
|
391
|
-
@ats_activity.primary_loaded?.should eql(true)
|
392
|
-
end
|
393
|
-
|
394
|
-
it "should have a ats asset_id" do
|
395
|
-
@ats_activity.primary_loaded?.should eql(false)
|
396
|
-
@ats_activity.asset_id.should eql("EEBC04D9-EA80-46C6-B9DD-6EBF49F8678F")
|
397
|
-
@ats_activity.primary_loaded?.should eql(false)
|
398
|
-
end
|
399
|
-
it "should have an primary source asset_id" do
|
400
|
-
@ats_activity.primary_loaded?.should eql(false)
|
401
|
-
@ats_activity._asset_id.should eql("eebc04d9-ea80-46c6-b9dd-6ebf49f8678f")
|
402
|
-
@ats_activity.primary_loaded?.should eql(true)
|
403
|
-
end
|
404
|
-
|
405
|
-
it "should have a ats asset_type_id" do
|
406
|
-
@ats_activity.primary_loaded?.should eql(false)
|
407
|
-
@ats_activity.asset_type_id.should eql("EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65")
|
408
|
-
@ats_activity.primary_loaded?.should eql(false)
|
409
|
-
end
|
410
|
-
|
411
|
-
end
|
412
|
-
describe "regristration_available?" do
|
413
|
-
it "should have a valid response for regristration_status" do
|
414
|
-
results = Search.search( { :num_results => 50, :keywords => ["running"] } )
|
415
|
-
results.should have(50).results
|
416
|
-
results.results.each do |a|
|
417
|
-
a.regristration_status.should match(/reg-open|reg-unavailable|reg-not-open|reg-closed/)
|
418
|
-
end
|
419
|
-
end
|
420
|
-
end
|
421
|
-
end
|