# 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&amp;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 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 an address Hash" do a = RegCenter.find_by_id(@valid_id) a.address.should be_an_instance_of(HashWithIndifferentAccess) 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 end