Active 0.0.14 → 0.0.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.
data/spec/reg_spec.rb CHANGED
@@ -8,13 +8,17 @@ include Active::Services
8
8
 
9
9
  describe RegCenter do
10
10
  before(:each) do
11
- @valid_id = "1802851"
11
+ # @valid_id = "1802851"
12
+ @valid_id = "1877942"
12
13
  # @valid_id = "1889826"
13
14
  # @valid_id = "1847738"
15
+ # <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><getAssetMetadataResponse xmlns="http://api.asset.services.active.com"><out xmlns="http://api.asset.services.active.com">&lt;importSource>&lt;asset row="1" destinationID="">&lt;isSearchable>true&lt;/isSearchable>&lt;assetId>BF304447-0052-4466-A044-68D1459C5068&lt;/assetId>&lt;assetTypeId>EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65&lt;/assetTypeId>&lt;substitutionUrl>1886328&lt;/substitutionUrl>&lt;assetName>Excellence in Writing&lt;/assetName>&lt;category>Activities&lt;/category>&lt;channel>Not Specified&lt;/channel>&lt;mediaType>Recware Activities&lt;/mediaType>&lt;searchWeight>1&lt;/searchWeight>&lt;zip>92027&lt;/zip>&lt;city>Escondido&lt;/city>&lt;state>California&lt;/state>&lt;country>United States&lt;/country>&lt;startDate>2010-09-07&lt;/startDate>&lt;startTime>15:30:00&lt;/startTime>&lt;endDate>2010-09-07&lt;/endDate>&lt;endTime>15:30:00&lt;/endTime>&lt;participationCriteria>All&lt;/participationCriteria>&lt;onlineRegistrationAvailable>true&lt;/onlineRegistrationAvailable>&lt;onlineDonationAvailable>0&lt;/onlineDonationAvailable>&lt;onlineMembershipAvailable>0&lt;/onlineMembershipAvailable>&lt;avgUserRating/>&lt;userCommentText/>&lt;image1>http://www.active.com/images/events/hotrace.gif&lt;/image1>&lt;contactEmail>recreation@escondido.org&lt;/contactEmail>&lt;contactPhone>760-839-4691&lt;/contactPhone>&lt;eventResults/>&lt;location>Grove Room - East Valley Community Center&lt;/location>&lt;contactName>Escondido Community Services Department&lt;/contactName>&lt;market>San Diego&lt;/market>&lt;trackbackurl>http://www.active.com/page/Event_Details.htm?event_id=1886328&amp;amp;assetId=BF304447-0052-4466-A044-68D1459C5068&lt;/trackbackurl>&lt;seourl>http://www.active.com/not-specified-recware-activities/escondido-ca/excellence-in-writing-2010&lt;/seourl>&lt;dma>San Diego&lt;/dma>&lt;longitude>-117.0864&lt;/longitude>&lt;latitude>33.11921&lt;/latitude>&lt;/asset>&lt;/importSource></out></getAssetMetadataResponse></soap:Body></soap:Envelope>
16
+
14
17
  end
15
18
  it "should set find by id" do
16
19
  a = RegCenter.find_by_id(@valid_id)
17
- a.data["id"].should == @valid_id
20
+ a.data.should_not be_nil
21
+ a.title.should eql("Realistic Drawing (6-12 Yrs.)")
18
22
  end
19
23
  it "should set the asset_type_id" do
20
24
  RegCenter.find_by_id(@valid_id).asset_type_id.should_not be_nil
@@ -28,7 +32,7 @@ describe RegCenter do
28
32
  end
29
33
  it "should have an address Hash" do
30
34
  a = RegCenter.find_by_id(@valid_id)
31
- a.address.should be_an_instance_of(Hash)
35
+ a.address.should be_an_instance_of(HashWithIndifferentAccess)
32
36
  end
33
37
  it "should have a desc String" do
34
38
  a = RegCenter.find_by_id(@valid_id)
@@ -38,19 +42,24 @@ describe RegCenter do
38
42
  a = RegCenter.find_by_id(@valid_id)
39
43
  a.title.should_not include("\r")
40
44
  end
41
- it "should have a primary category" do
42
- a = RegCenter.find_by_id(@valid_id)
43
- puts a.primary_category
44
- a.primary_category.should_not be_nil
45
- end
45
+ # it "should have a primary category" do
46
+ # a = RegCenter.find_by_id(@valid_id)
47
+ # puts a.primary_category
48
+ # a.primary_category.should_not be_nil
49
+ # end
46
50
  it "should have a title String" do
47
51
  a = RegCenter.find_by_id(@valid_id)
48
52
  a.title.should be_an_instance_of(String)
49
53
  end
50
54
  it "should have a categories array" do
51
55
  a = RegCenter.find_by_id(@valid_id)
56
+ puts a.categories.inspect
52
57
  a.categories.should be_an_instance_of(Array)
53
58
  end
59
+ # it "should have a category" do
60
+ # a = RegCenter.find_by_id(@valid_id)
61
+ # a.category.should be_an_instance_of(String)
62
+ # end
54
63
  it "should have a start_date DateTime" do
55
64
  a = RegCenter.find_by_id(@valid_id)
56
65
  puts a.start_date
@@ -0,0 +1,49 @@
1
+ require 'dalli'
2
+ require 'fake_web'
3
+ # Require the spec helper relative to this file
4
+ require File.join(File.dirname(__FILE__), %w[spec_helper])
5
+ require File.join(File.dirname(__FILE__), %w[custom_matchers_spec])
6
+ require File.join(File.dirname(__FILE__), %w[ .. lib services search])
7
+ require File.join(File.dirname(__FILE__), %w[ .. lib services activity])
8
+ include Active::Services
9
+ Active.memcache_host "localhost:11211"
10
+
11
+ describe Search do
12
+ include CustomMatchers
13
+ before(:each) do
14
+ Active.CACHE.flush()
15
+ end
16
+ it "shouls search by city" do
17
+ s = Search.search({:city=>"Oceanside"})
18
+ s.city.should eql("Oceanside")
19
+ s.results.should_not be_nil
20
+ s.results.should have_at_least(1).items
21
+
22
+ Active.CACHE.get('ce16c9ef2b618d0d5a88d46933109e4d').results.length.should eql(10)
23
+
24
+ s = Search.search({:city=>"Oceanside"})
25
+ s.city.should eql("Oceanside")
26
+ s.results.should_not be_nil
27
+ s.results.should have_at_least(1).items
28
+
29
+ end
30
+
31
+ end
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+