# Require the spec helper relative to this file
require File.join(File.dirname(__FILE__), %w[spec_helper])
require File.join(File.dirname(__FILE__), %w[custom_matchers_spec])
require File.join(File.dirname(__FILE__), %w[ .. lib services search])
require File.join(File.dirname(__FILE__), %w[ .. lib services activity])
require File.join(File.dirname(__FILE__), %w[ .. lib services reg_center])
include Active::Services
describe RegCenter do
before(:each) do
# @valid_id = "1802851"
@valid_id = "1877942"
# @valid_id = "1889826"
# @valid_id = "1847738"
# <importSource><asset row="1" destinationID=""><isSearchable>true</isSearchable><assetId>BF304447-0052-4466-A044-68D1459C5068</assetId><assetTypeId>EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65</assetTypeId><substitutionUrl>1886328</substitutionUrl><assetName>Excellence in Writing</assetName><category>Activities</category><channel>Not Specified</channel><mediaType>Recware Activities</mediaType><searchWeight>1</searchWeight><zip>92027</zip><city>Escondido</city><state>California</state><country>United States</country><startDate>2010-09-07</startDate><startTime>15:30:00</startTime><endDate>2010-09-07</endDate><endTime>15:30:00</endTime><participationCriteria>All</participationCriteria><onlineRegistrationAvailable>true</onlineRegistrationAvailable><onlineDonationAvailable>0</onlineDonationAvailable><onlineMembershipAvailable>0</onlineMembershipAvailable><avgUserRating/><userCommentText/><image1>http://www.active.com/images/events/hotrace.gif</image1><contactEmail>recreation@escondido.org</contactEmail><contactPhone>760-839-4691</contactPhone><eventResults/><location>Grove Room - East Valley Community Center</location><contactName>Escondido Community Services Department</contactName><market>San Diego</market><trackbackurl>http://www.active.com/page/Event_Details.htm?event_id=1886328&assetId=BF304447-0052-4466-A044-68D1459C5068</trackbackurl><seourl>http://www.active.com/not-specified-recware-activities/escondido-ca/excellence-in-writing-2010</seourl><dma>San Diego</dma><longitude>-117.0864</longitude><latitude>33.11921</latitude></asset></importSource>
end
it "should create a new regCenter class" do
r = RegCenter.new(Hash.from_xml(' 5c6fa2f2-0434-4d6c-953d-cab9bade4f64 1877942 Realistic Drawing (6-12 Yrs.) 2010-09-16T15:30:00-07:00 3:30 PM Arts & Crafts Room - Nick Rodriguez Community Center 213 "F" Street Antioch California 94509 USA Do you love to draw?Learn how to make your drawings more realistic with projects that focus on observation,proportion,perspective,composition,light and shadow and texture.Media will include pencil,pen,charcoal,and pastel.A &10 materials fee is payable to the instuctor at the first class. false true 2010-09-16T00:00:00-07:00 USD 1 Recware Activities false false true -121.8058 38.00492 dadams@ci.antioch.ca.us 925-779-7070 true false Activities Recware Activities false Ages 1 6 years - 12 years 11months Instructor 2 Nancy Roberts Code 3 1447.401 Classification 4 Art Schedule 5 Occurs every week on Thursday effective 9/16/10 until 10/21/10 from 3:30 PM to 4:30 PM http://www.active.com/page/Event_Details.htm?event_id=1877942 http://www.active.com/event_contact.cfm?event_id=1877942 '))
r.title.should eql("Realistic Drawing (6-12 Yrs.)")
end
it "should have an address Hash" do
r = RegCenter.new(Hash.from_xml(' 5c6fa2f2-0434-4d6c-953d-cab9bade4f64 1877942 Realistic Drawing (6-12 Yrs.) 2010-09-16T15:30:00-07:00 3:30 PM Arts & Crafts Room - Nick Rodriguez Community Center 213 "F" Street Antioch California 94509 USA Do you love to draw?Learn how to make your drawings more realistic with projects that focus on observation,proportion,perspective,composition,light and shadow and texture.Media will include pencil,pen,charcoal,and pastel.A &10 materials fee is payable to the instuctor at the first class. false true 2010-09-16T00:00:00-07:00 USD 1 Recware Activities false false true -121.8058 38.00492 dadams@ci.antioch.ca.us 925-779-7070 true false Activities Recware Activities false Ages 1 6 years - 12 years 11months Instructor 2 Nancy Roberts Code 3 1447.401 Classification 4 Art Schedule 5 Occurs every week on Thursday effective 9/16/10 until 10/21/10 from 3:30 PM to 4:30 PM http://www.active.com/page/Event_Details.htm?event_id=1877942 http://www.active.com/event_contact.cfm?event_id=1877942 '))
r.address.should be_an_instance_of(HashWithIndifferentAccess)
end
it "should have address data" do
r = RegCenter.new(Hash.from_xml(' 5c6fa2f2-0434-4d6c-953d-cab9bade4f64 1877942 Realistic Drawing (6-12 Yrs.) 2010-09-16T15:30:00-07:00 3:30 PM Arts & Crafts Room - Nick Rodriguez Community Center 213 "F" Street Antioch California 94509 USA Do you love to draw?Learn how to make your drawings more realistic with projects that focus on observation,proportion,perspective,composition,light and shadow and texture.Media will include pencil,pen,charcoal,and pastel.A &10 materials fee is payable to the instuctor at the first class. false true 2010-09-16T00:00:00-07:00 USD 1 Recware Activities false false true -121.8058 38.00492 dadams@ci.antioch.ca.us 925-779-7070 true false Activities Recware Activities false Ages 1 6 years - 12 years 11months Instructor 2 Nancy Roberts Code 3 1447.401 Classification 4 Art Schedule 5 Occurs every week on Thursday effective 9/16/10 until 10/21/10 from 3:30 PM to 4:30 PM http://www.active.com/page/Event_Details.htm?event_id=1877942 http://www.active.com/event_contact.cfm?event_id=1877942 '))
r.address["name"].should eql "Arts & Crafts Room - Nick Rodriguez Community Center"
r.address["address"].should eql "213 \"F\" Street"
r.address["city"].should eql "Antioch"
r.address["state"].should eql "California"
r.address["zip"].should eql "94509"
r.address["lat"].should eql "38.00492"
r.address["lng"].should eql "-121.8058"
r.address["country"].should eql "USA"
end
it "should have an address Hash" do
r = RegCenter.new(Hash.from_xml("\n\n 7e39ceb4-cebb-471f-ace3-21f697ae9e55\n 1802851\n Rock 'n' Roll San Jose Half Marathon\n 2010-10-03T08:00:00-07:00\n 08:00 am\n Downtown\n Almaden Blvd & Santa Clara Street\n San Jose\n California\n 95192\n USA\n Registration Fees:* \t
\n<p>
\n1/2 Marathon
\n<p>
\n * $85.00 \342\200\223 October 2009- July 31, 2010<br>
\n * $100.00 \342\200\223 August 1, 2010- September 26<br>
\n * $120.00 \342\200\223 Expo Price<br>
\n<p>
\n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION\n false\n false\n USD\n 7\n Event, Race\n false\n true\n true\n -121.8818\n 37.3359\n rnrsj@eliteracing.com\n 800-311-1255\n true\n false\n Rock 'n' Roll Half Marathon\n 98616\n Activities\n \n Event\n Event\\Half Marathon\n =difficulty:Advanced\n =difficulty:Beginner\n =difficulty:Intermediate\n \n \n \n a401eaf3-6087-4dd2-822c-635a7ae45e74\n 1614834\n Rock 'n' Roll Half Marathon - San Jose\n 2009-10-04T08:00:00-07:00\n http://www.active.com/page/Event_Details.htm?event_id=1614834\n \n \n \n \n Running\n true\n \n \n \n \n \n Online Registration Closes\n 1\n Sunday, September 26, 2010\n \n \n \n \n http://san-jose.competitor.com\n http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851\n http://www.active.com/page/Event_Details.htm?event_id=1802851\n http://www.active.com/event_contact.cfm?event_id=1802851\n http://www.active.com/images/upimages/1802851.jpg\n\n"))
r.address.should be_an_instance_of(HashWithIndifferentAccess)
end
it "should have address data" do
r = RegCenter.new(Hash.from_xml("\n\n 7e39ceb4-cebb-471f-ace3-21f697ae9e55\n 1802851\n Rock 'n' Roll San Jose Half Marathon\n 2010-10-03T08:00:00-07:00\n 08:00 am\n Downtown\n Almaden Blvd & Santa Clara Street\n San Jose\n California\n 95192\n USA\n Registration Fees:* \t
\n<p>
\n1/2 Marathon
\n<p>
\n * $85.00 \342\200\223 October 2009- July 31, 2010<br>
\n * $100.00 \342\200\223 August 1, 2010- September 26<br>
\n * $120.00 \342\200\223 Expo Price<br>
\n<p>
\n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION\n false\n false\n USD\n 7\n Event, Race\n false\n true\n true\n -121.8818\n 37.3359\n rnrsj@eliteracing.com\n 800-311-1255\n true\n false\n Rock 'n' Roll Half Marathon\n 98616\n Activities\n \n Event\n Event\\Half Marathon\n =difficulty:Advanced\n =difficulty:Beginner\n =difficulty:Intermediate\n \n \n \n a401eaf3-6087-4dd2-822c-635a7ae45e74\n 1614834\n Rock 'n' Roll Half Marathon - San Jose\n 2009-10-04T08:00:00-07:00\n http://www.active.com/page/Event_Details.htm?event_id=1614834\n \n \n \n \n Running\n true\n \n \n \n \n \n Online Registration Closes\n 1\n Sunday, September 26, 2010\n \n \n \n \n http://san-jose.competitor.com\n http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851\n http://www.active.com/page/Event_Details.htm?event_id=1802851\n http://www.active.com/event_contact.cfm?event_id=1802851\n http://www.active.com/images/upimages/1802851.jpg\n\n"))
r.address["name"].should eql "Downtown"
r.address["address"].should eql "Almaden Blvd & Santa Clara Street"
r.address["city"].should eql "San Jose"
r.address["state"].should eql "California"
r.address["zip"].should eql "95192"
r.address["lat"].should eql "37.3359"
r.address["lng"].should eql "-121.8818"
r.address["country"].should eql "USA"
end
it "should nil empty address data" do
r = RegCenter.new(Hash.from_xml("\n\n 7e39ceb4-cebb-471f-ace3-21f697ae9e55\n 1802851\n Rock 'n' Roll San Jose Half Marathon\n 2010-10-03T08:00:00-07:00\n 08:00 am\n Downtown\n \n San Jose\n California\n x95192\n USA\n Registration Fees:* \t
\n<p>
\n1/2 Marathon
\n<p>
\n * $85.00 \342\200\223 October 2009- July 31, 2010<br>
\n * $100.00 \342\200\223 August 1, 2010- September 26<br>
\n * $120.00 \342\200\223 Expo Price<br>
\n<p>
\n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION\n false\n false\n USD\n 7\n Event, Race\n false\n true\n true\n -121.8818\n 37.3359\n rnrsj@eliteracing.com\n 800-311-1255\n true\n false\n Rock 'n' Roll Half Marathon\n 98616\n Activities\n \n Event\n Event\\Half Marathon\n =difficulty:Advanced\n =difficulty:Beginner\n =difficulty:Intermediate\n \n \n \n a401eaf3-6087-4dd2-822c-635a7ae45e74\n 1614834\n Rock 'n' Roll Half Marathon - San Jose\n 2009-10-04T08:00:00-07:00\n http://www.active.com/page/Event_Details.htm?event_id=1614834\n \n \n \n \n Running\n true\n \n \n \n \n \n Online Registration Closes\n 1\n Sunday, September 26, 2010\n \n \n \n \n http://san-jose.competitor.com\n http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851\n http://www.active.com/page/Event_Details.htm?event_id=1802851\n http://www.active.com/event_contact.cfm?event_id=1802851\n http://www.active.com/images/upimages/1802851.jpg\n\n"))
r.address["address"].should be_nil
end
it "should nil bad zip code data" do
r = RegCenter.new(Hash.from_xml("\n\n 7e39ceb4-cebb-471f-ace3-21f697ae9e55\n 1802851\n Rock 'n' Roll San Jose Half Marathon\n 2010-10-03T08:00:00-07:00\n 08:00 am\n Downtown\n \n San Jose\n California\n x95192\n USA\n Registration Fees:* \t
\n<p>
\n1/2 Marathon
\n<p>
\n * $85.00 \342\200\223 October 2009- July 31, 2010<br>
\n * $100.00 \342\200\223 August 1, 2010- September 26<br>
\n * $120.00 \342\200\223 Expo Price<br>
\n<p>
\n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION\n false\n false\n USD\n 7\n Event, Race\n false\n true\n true\n -121.8818\n 37.3359\n rnrsj@eliteracing.com\n 800-311-1255\n true\n false\n Rock 'n' Roll Half Marathon\n 98616\n Activities\n \n Event\n Event\\Half Marathon\n =difficulty:Advanced\n =difficulty:Beginner\n =difficulty:Intermediate\n \n \n \n a401eaf3-6087-4dd2-822c-635a7ae45e74\n 1614834\n Rock 'n' Roll Half Marathon - San Jose\n 2009-10-04T08:00:00-07:00\n http://www.active.com/page/Event_Details.htm?event_id=1614834\n \n \n \n \n Running\n true\n \n \n \n \n \n Online Registration Closes\n 1\n Sunday, September 26, 2010\n \n \n \n \n http://san-jose.competitor.com\n http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851\n http://www.active.com/page/Event_Details.htm?event_id=1802851\n http://www.active.com/event_contact.cfm?event_id=1802851\n http://www.active.com/images/upimages/1802851.jpg\n\n"))
r.address["zip"].should be_nil
end
it "should fix state abbreviations" do
r = RegCenter.new(Hash.from_xml("\n\n 7e39ceb4-cebb-471f-ace3-21f697ae9e55\n 1802851\n Rock 'n' Roll San Jose Half Marathon\n 2010-10-03T08:00:00-07:00\n 08:00 am\n Downtown\n \n San Jose\n CA\n x95192\n USA\n Registration Fees:* \t
\n<p>
\n1/2 Marathon
\n<p>
\n * $85.00 \342\200\223 October 2009- July 31, 2010<br>
\n * $100.00 \342\200\223 August 1, 2010- September 26<br>
\n * $120.00 \342\200\223 Expo Price<br>
\n<p>
\n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION\n false\n false\n USD\n 7\n Event, Race\n false\n true\n true\n -121.8818\n 37.3359\n rnrsj@eliteracing.com\n 800-311-1255\n true\n false\n Rock 'n' Roll Half Marathon\n 98616\n Activities\n \n Event\n Event\\Half Marathon\n =difficulty:Advanced\n =difficulty:Beginner\n =difficulty:Intermediate\n \n \n \n a401eaf3-6087-4dd2-822c-635a7ae45e74\n 1614834\n Rock 'n' Roll Half Marathon - San Jose\n 2009-10-04T08:00:00-07:00\n http://www.active.com/page/Event_Details.htm?event_id=1614834\n \n \n \n \n Running\n true\n \n \n \n \n \n Online Registration Closes\n 1\n Sunday, September 26, 2010\n \n \n \n \n http://san-jose.competitor.com\n http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851\n http://www.active.com/page/Event_Details.htm?event_id=1802851\n http://www.active.com/event_contact.cfm?event_id=1802851\n http://www.active.com/images/upimages/1802851.jpg\n\n"))
r.address["state"].should eql "California"
end
it "should have a nil user email" do
r = RegCenter.new(Hash.from_xml("\n\n 7e39ceb4-cebb-471f-ace3-21f697ae9e55\n 1802851\n Rock 'n' Roll San Jose Half Marathon\n 2010-10-03T08:00:00-07:00\n 08:00 am\n Downtown\n \n San Jose\n CA\n x95192\n USA\n Registration Fees:* \t
\n<p>
\n1/2 Marathon
\n<p>
\n * $85.00 \342\200\223 October 2009- July 31, 2010<br>
\n * $100.00 \342\200\223 August 1, 2010- September 26<br>
\n * $120.00 \342\200\223 Expo Price<br>
\n<p>
\n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION\n false\n false\n USD\n 7\n Event, Race\n false\n true\n true\n -121.8818\n 37.3359\n 800-311-1255\n true\n false\n Rock 'n' Roll Half Marathon\n 98616\n Activities\n \n Event\n Event\\Half Marathon\n =difficulty:Advanced\n =difficulty:Beginner\n =difficulty:Intermediate\n \n \n \n a401eaf3-6087-4dd2-822c-635a7ae45e74\n 1614834\n Rock 'n' Roll Half Marathon - San Jose\n 2009-10-04T08:00:00-07:00\n http://www.active.com/page/Event_Details.htm?event_id=1614834\n \n \n \n \n Running\n true\n \n \n \n \n \n Online Registration Closes\n 1\n Sunday, September 26, 2010\n \n \n \n \n http://san-jose.competitor.com\n http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851\n http://www.active.com/page/Event_Details.htm?event_id=1802851\n http://www.active.com/event_contact.cfm?event_id=1802851\n http://www.active.com/images/upimages/1802851.jpg\n\n"))
r.user.email.should be_nil
end
it "should have a nil user email" do
r = RegCenter.new(Hash.from_xml("\n\n 7e39ceb4-cebb-471f-ace3-21f697ae9e55\n 1802851\n Rock 'n' Roll San Jose Half Marathon\n 2010-10-03T08:00:00-07:00\n 08:00 am\n Downtown\n \n San Jose\n CA\n x95192\n USA\n Registration Fees:* \t
\n<p>
\n1/2 Marathon
\n<p>
\n * $85.00 \342\200\223 October 2009- July 31, 2010<br>
\n * $100.00 \342\200\223 August 1, 2010- September 26<br>
\n * $120.00 \342\200\223 Expo Price<br>
\n<p>
\n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION\n false\n false\n USD\n 7\n Event, Race\n false\n true\n true\n -121.8818\n 37.3359\n 800-311-1255\n true\n false\n Rock 'n' Roll Half Marathon\n 98616\n Activities\n \n Event\n Event\\Half Marathon\n =difficulty:Advanced\n =difficulty:Beginner\n =difficulty:Intermediate\n \n \n \n a401eaf3-6087-4dd2-822c-635a7ae45e74\n 1614834\n Rock 'n' Roll Half Marathon - San Jose\n 2009-10-04T08:00:00-07:00\n http://www.active.com/page/Event_Details.htm?event_id=1614834\n \n \n \n \n Running\n true\n \n \n \n \n \n Online Registration Closes\n 1\n Sunday, September 26, 2010\n \n \n \n \n http://san-jose.competitor.com\n http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851\n http://www.active.com/page/Event_Details.htm?event_id=1802851\n http://www.active.com/event_contact.cfm?event_id=1802851\n http://www.active.com/images/upimages/1802851.jpg\n\n"))
r.user.email.should be_nil
end
it "should have a nil user email when the email is not valid" do
r = RegCenter.new(Hash.from_xml("\n\n 7e39ceb4-cebb-471f-ace3-21f697ae9e55\n 1802851\n Rock 'n' Roll San Jose Half Marathon\n 2010-10-03T08:00:00-07:00\n 08:00 am\n Downtown\n \n San Jose\n CA\n x95192\n USA\n Registration Fees:* \t
\n<p>
\n1/2 Marathon
\n<p>
\n * $85.00 \342\200\223 October 2009- July 31, 2010<br>
\n * $100.00 \342\200\223 August 1, 2010- September 26<br>
\n * $120.00 \342\200\223 Expo Price<br>
\n<p>
\n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION\n false\n false\n USD\n 7\n Event, Race\n false\n true\n true\n -121.8818\n 37.3359\n rnrsjeliteracingcom\n 800-311-1255\n true\n false\n Rock 'n' Roll Half Marathon\n 98616\n Activities\n \n Event\n Event\\Half Marathon\n =difficulty:Advanced\n =difficulty:Beginner\n =difficulty:Intermediate\n \n \n \n a401eaf3-6087-4dd2-822c-635a7ae45e74\n 1614834\n Rock 'n' Roll Half Marathon - San Jose\n 2009-10-04T08:00:00-07:00\n http://www.active.com/page/Event_Details.htm?event_id=1614834\n \n \n \n \n Running\n true\n \n \n \n \n \n Online Registration Closes\n 1\n Sunday, September 26, 2010\n \n \n \n \n http://san-jose.competitor.com\n http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851\n http://www.active.com/page/Event_Details.htm?event_id=1802851\n http://www.active.com/event_contact.cfm?event_id=1802851\n http://www.active.com/images/upimages/1802851.jpg\n\n"))
r.user.email.should be_nil
end
it "should have a valid user email" do
r = RegCenter.new(Hash.from_xml("\n\n 7e39ceb4-cebb-471f-ace3-21f697ae9e55\n 1802851\n Rock 'n' Roll San Jose Half Marathon\n 2010-10-03T08:00:00-07:00\n 08:00 am\n Downtown\n \n San Jose\n California\n x95192\n USA\n Registration Fees:* \t
\n<p>
\n1/2 Marathon
\n<p>
\n * $85.00 \342\200\223 October 2009- July 31, 2010<br>
\n * $100.00 \342\200\223 August 1, 2010- September 26<br>
\n * $120.00 \342\200\223 Expo Price<br>
\n<p>
\n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION\n false\n false\n USD\n 7\n Event, Race\n false\n true\n true\n -121.8818\n 37.3359\n rnrsj@eliteracing.com\n 800-311-1255\n true\n false\n Rock 'n' Roll Half Marathon\n 98616\n Activities\n \n Event\n Event\\Half Marathon\n =difficulty:Advanced\n =difficulty:Beginner\n =difficulty:Intermediate\n \n \n \n a401eaf3-6087-4dd2-822c-635a7ae45e74\n 1614834\n Rock 'n' Roll Half Marathon - San Jose\n 2009-10-04T08:00:00-07:00\n http://www.active.com/page/Event_Details.htm?event_id=1614834\n \n \n \n \n Running\n true\n \n \n \n \n \n Online Registration Closes\n 1\n Sunday, September 26, 2010\n \n \n \n \n http://san-jose.competitor.com\n http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851\n http://www.active.com/page/Event_Details.htm?event_id=1802851\n http://www.active.com/event_contact.cfm?event_id=1802851\n http://www.active.com/images/upimages/1802851.jpg\n\n"))
r.user.email.should eql("rnrsj@eliteracing.com")
end
# it "should get asset metadata" do
# a = RegCenter.get_asset_metadata(@valid_id)
# a.should be_valid
# end
it "should set find by id" do
a = RegCenter.find_by_id(@valid_id)
a.data.should_not be_nil
a.title.should eql("Realistic Drawing (6-12 Yrs.)")
end
it "should set the asset_type_id" do
RegCenter.find_by_id(@valid_id).asset_type_id.should_not be_nil
end
it "should thorw an RegCenterError if no record is found" do
lambda { RegCenter.find_by_id( "666" ) }.should raise_error(RegCenterError)
end
it "should get the API metadata" do
a = RegCenter.find_by_id(@valid_id)
a.data["event"].should_not be_nil
end
it "should have a desc String" do
a = RegCenter.find_by_id(@valid_id)
a.desc.should be_an_instance_of(String)
end
it "should cleanup title" do
a = RegCenter.find_by_id(@valid_id)
a.title.should_not include("\r")
end
# it "should have a primary category" do
# a = RegCenter.find_by_id(@valid_id)
# puts a.primary_category
# a.primary_category.should_not be_nil
# end
it "should have a title String" do
a = RegCenter.find_by_id(@valid_id)
a.title.should be_an_instance_of(String)
end
it "should have a categories array" do
a = RegCenter.find_by_id(@valid_id)
puts a.categories.inspect
a.categories.should be_an_instance_of(Array)
end
# it "should have a category" do
# a = RegCenter.find_by_id(@valid_id)
# a.category.should be_an_instance_of(String)
# end
it "should have a start_date DateTime" do
a = RegCenter.find_by_id(@valid_id)
puts a.start_date
a.start_date.should be_an_instance_of(DateTime)
end
it "should have a start_time DateTime" do
a = RegCenter.find_by_id(@valid_id)
a.start_time.should be_an_instance_of(DateTime)
end
it "should have a valid eventURL" do
r = RegCenter.new(Hash.from_xml("\n\n 7e39ceb4-cebb-471f-ace3-21f697ae9e55\n 1802851\n Rock 'n' Roll San Jose Half Marathon\n 2010-10-03T08:00:00-07:00\n 08:00 am\n Downtown\n Almaden Blvd & Santa Clara Street\n San Jose\n California\n 95192\n USA\n Registration Fees:* \t
\n<p>
\n1/2 Marathon
\n<p>
\n * $85.00 \342\200\223 October 2009- July 31, 2010<br>
\n * $100.00 \342\200\223 August 1, 2010- September 26<br>
\n * $120.00 \342\200\223 Expo Price<br>
\n<p>
\n*Registration fees are non-refundable and non-transferable. Fees listed above do not include the Active Network processing fee. NO RACE DAY REGISTRATION\n false\n false\n USD\n 7\n Event, Race\n false\n true\n true\n -121.8818\n 37.3359\n rnrsj@eliteracing.com\n 800-311-1255\n true\n false\n Rock 'n' Roll Half Marathon\n 98616\n Activities\n \n Event\n Event\\Half Marathon\n =difficulty:Advanced\n =difficulty:Beginner\n =difficulty:Intermediate\n \n \n \n a401eaf3-6087-4dd2-822c-635a7ae45e74\n 1614834\n Rock 'n' Roll Half Marathon - San Jose\n 2009-10-04T08:00:00-07:00\n http://www.active.com/page/Event_Details.htm?event_id=1614834\n \n \n \n \n Running\n true\n \n \n \n \n \n Online Registration Closes\n 1\n Sunday, September 26, 2010\n \n \n \n \n http://san-jose.competitor.com\n http://results.active.com/pages/page.jsp?pubID=3&eventID=1802851\n http://www.active.com/page/Event_Details.htm?event_id=1802851\n http://www.active.com/event_contact.cfm?event_id=1802851\n http://www.active.com/images/upimages/1802851.jpg\n\n"))
r.event_url.should eql("http://san-jose.competitor.com")
end
it "should have a valid content" do
r = RegCenter.new(Hash.from_xml(' 5c6fa2f2-0434-4d6c-953d-cab9bade4f64 1877942 Realistic Drawing (6-12 Yrs.) 2010-09-16T15:30:00-07:00 3:30 PM Arts & Crafts Room - Nick Rodriguez Community Center 213 "F" Street Antioch California 94509 USA Do you love to draw?Learn how to make your drawings more realistic with projects that focus on observation,proportion,perspective,composition,light and shadow and texture.Media will include pencil,pen,charcoal,and pastel.A &10 materials fee is payable to the instuctor at the first class. false true 2010-09-16T00:00:00-07:00 USD 1 Recware Activities false false true -121.8058 38.00492 dadams@ci.antioch.ca.us 925-779-7070 true false Activities Recware Activities false Ages 1 6 years - 12 years 11months Instructor 2 Nancy Roberts Code 3 1447.401 Classification 4 Art Schedule 5 Occurs every week on Thursday effective 9/16/10 until 10/21/10 from 3:30 PM to 4:30 PM http://www.active.com/page/Event_Details.htm?event_id=1877942 http://www.active.com/event_contact.cfm?event_id=1877942 '))
r.content.should be_an_instance_of(Array)
r.content[0][:title].should eql("Ages")
r.content[1][:title].should eql("Instructor")
r.content[2][:title].should eql("Code")
r.content[3][:title].should eql("Classification")
r.content[4][:title].should eql("Schedule")
r.content[0][:content].should eql("6 years - 12 years 11months")
r.content[1][:content].should eql("Nancy Roberts")
r.content[2][:content].should eql("1447.401")
r.content[3][:content].should eql("Art")
r.content[4][:content].should eql("Occurs every week on Thursday effective 9/16/10 until 10/21/10 from 3:30 PM to 4:30 PM")
end
it "should handle not having extra content" do
r = RegCenter.new(Hash.from_xml(' 396e12ba-d496-4d3c-ad76-4ac581ac7628 1893115 San Francisco Halloween Run & Walk for Schools 2010-10-31T08:30:00-07:00 Mile starts 8:30 AM, 5K starts 9 AM John F. Kennedy Drive at Middle Drive in Golden Gate Park. San Francisco California 94117 USA Both the 5K and mile are USATF Certified distances that visit some of Golden Gate Park’s best views. <b>The Jefferson Mile is the 2010 RRCA California State Championship Mile. It Starts 8:30 AM</b>. <b>The 5K is flat and fast with a couple of easy hills and Starts 9 AM on JFK, East of the Conservatory of Flowers. Certified Maps at PeopleEvents.org</b> Awards 3 deep in all divisions 8 & under to 80+ Prizes for winners, top pledge collector and random drawing. We feature online Finish Videos and post downloadable Finish Line Photos. false true 2010-10-30T11:59:00-07:00 5K or Mile: $25 includes T-shirt until 10/19, $30 after<p>Combo (Mile & 5K): $30 until 10/19, $35 after<p>Kids 12 & under w/t-shirt: $15 until 10/19 USD 7 Event, Race false false false -122.4438929 37.7717185 Bill_Dake@peopleevents.org 650 291-8531 true false Activities Event Event\1 mile Event\5K Running true Event Flyer 1 <a href=http://www.eteamz.com/activeactive1/files/0913halloweenentryv5-new.pdf> Click Here to View Event Flyer</a> 158285 SF Halloween Run & Walk for Schools http://www.active.com/donate/sfrunwalkforschools http://www.PeopleEvents.org http://www.active.com/page/Event_Details.htm?event_id=1893115 http://www.active.com/event_contact.cfm?event_id=1893115 http://www.active.com/images/upimages/halloween10_blk.jpg'))
r.content.should be_an_instance_of(Array)
r.content[0][:title].should eql("Event Flyer")
r.content[0][:content].should eql(" Click Here to View Event Flyer")
end
end