# 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 ats]) require File.join(File.dirname(__FILE__), %w[ .. lib services address]) include Active::Services describe ATS do before(:each) do # @valid_id = "A9EF9D79-F859-4443-A9BB-91E1833DF2D5" @valid_id="61BB7D71-EC01-46B8-A601-38CA1C9AE893" @reg_center_id = "D9A22F33-8A14-4175-8D5B-D11578212A98" end it "should set find by id" do a = ATS.find_by_id(@valid_id) a.asset_id.should == @valid_id end it "should get the asset_type_id" do ATS.find_by_id(@valid_id).asset_id_type.should_not be_nil end it "should thorw an ATSError if no record is found" do lambda { ATS.find_by_id( "666" ) }.should raise_error(ATSError) end it "should get the asset metadata" do ATS.get_asset_metadata(@valid_id).should_not be_nil end it "should load the asset metadata into @data" do a = ATS.find_by_id(@valid_id) a.load_metadata a.data["isSearchable"].should_not be_nil end it "should load the lazy the asset metadata" do a = ATS.find_by_id(@valid_id) puts a.url a.start_date.should_not be_nil end it "should only load metadata once" do a = ATS.find_by_id(@valid_id) puts a.url puts a.address ATS.should_receive(:load_metadata).once end it "should have an address Hash" do a = ATS.find_by_id(@valid_id) a.address.should be_an_instance_of(HashWithIndifferentAccess) end it "should have a startDate Date" do a = ATS.find_by_id(@valid_id) a.start_date.should be_an_instance_of(Date) end it "should have a title String" do a = ATS.find_by_id(@valid_id) a.title.should be_an_instance_of(String) end ########## it "should have an address" do a = ATS.new('trueFB27C928-54DB-4ECD-B42F-482FC3C8681Fvistarecreation/registrationmain.sdi?source=showAsset.sdi&activity_id=4900Zumba Punch Card (Adult) - Oct. (5)ActivitiesCommunity ServicesClass1People 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 sure to put the fun back into your work outs!92084VistaCaliforniaUnited States of America2010-10-02false2348.3213ae995d9-5c16-4176-b44e-fa0577644ca4http://www.active.com/page/event_details_an.htm?type=activenet&subUrl=vistarecreation/registrationmain.sdi?source=showAsset.sdi&activity_id=4900http://www.active.com/community-services-class/vista-ca/zumba-punch-card-adult-oct-5-2010San Diego-117.242535533.2000368') a.data.should_not be_nil end end