Active 0.0.14 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/lib/Active.rb +15 -0
- data/lib/services/IActivity.rb +34 -17
- data/lib/services/active_works.rb +5 -4
- data/lib/services/activity.rb +253 -70
- data/lib/services/address.rb +17 -0
- data/lib/services/ats.rb +82 -35
- data/lib/services/gsa.rb +153 -0
- data/lib/services/reg_center.rb +43 -21
- data/lib/services/sanitize.rb +108 -0
- data/lib/services/search.rb +101 -18
- data/lib/services/search.txt +403 -0
- data/lib/services/validators.rb +91 -0
- data/spec/Active_spec.rb +24 -1
- data/spec/activeworks_spec.rb +1 -1
- data/spec/activity_spec.rb +101 -170
- data/spec/ats_spec.rb +9 -3
- data/spec/gsa_spec.rb +123 -0
- data/spec/reg_spec.rb +17 -8
- data/spec/search_memcached_spec.rb +49 -0
- data/spec/search_spec.rb +404 -356
- data/version.txt +1 -1
- metadata +30 -6
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"><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></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
|
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(
|
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
|
-
|
43
|
-
|
44
|
-
|
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
|
+
|