muck-services 3.0.0 → 3.1.0
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/Rakefile +6 -9
- data/VERSION +1 -1
- data/muck-services.gemspec +241 -362
- metadata +9 -241
- data/.gitignore +0 -30
- data/test/rails_test/app/controllers/application_controller.rb +0 -24
- data/test/rails_test/app/controllers/default_controller.rb +0 -7
- data/test/rails_test/app/helpers/application_helper.rb +0 -3
- data/test/rails_test/app/models/activity.rb +0 -24
- data/test/rails_test/app/models/comment.rb +0 -23
- data/test/rails_test/app/models/country.rb +0 -13
- data/test/rails_test/app/models/language.rb +0 -15
- data/test/rails_test/app/models/share.rb +0 -20
- data/test/rails_test/app/models/state.rb +0 -13
- data/test/rails_test/app/models/user.rb +0 -45
- data/test/rails_test/app/models/user_session.rb +0 -2
- data/test/rails_test/config/application.rb +0 -42
- data/test/rails_test/config/boot.rb +0 -13
- data/test/rails_test/config/environment.rb +0 -5
- data/test/rails_test/config/environments/development.rb +0 -26
- data/test/rails_test/config/environments/production.rb +0 -49
- data/test/rails_test/config/environments/test.rb +0 -35
- data/test/rails_test/config/initializers/backtrace_silencers.rb +0 -7
- data/test/rails_test/config/initializers/inflections.rb +0 -10
- data/test/rails_test/config/initializers/mce_options.rb +0 -83
- data/test/rails_test/config/initializers/mime_types.rb +0 -5
- data/test/rails_test/config/initializers/muck.rb +0 -66
- data/test/rails_test/config/initializers/secret_token.rb +0 -7
- data/test/rails_test/config/initializers/session_store.rb +0 -8
- data/test/rails_test/config/routes.rb +0 -12
- data/test/rails_test/db/migrate/20090320174818_create_muck_permissions_and_roles.rb +0 -16
- data/test/rails_test/db/migrate/20090327231918_create_users.rb +0 -40
- data/test/rails_test/db/migrate/20090402033319_add_muck_activities.rb +0 -36
- data/test/rails_test/db/migrate/20090402234137_create_languages.rb +0 -18
- data/test/rails_test/db/migrate/20090426041056_create_countries.rb +0 -15
- data/test/rails_test/db/migrate/20090426041103_create_states.rb +0 -18
- data/test/rails_test/db/migrate/20090512013727_create_profiles.rb +0 -21
- data/test/rails_test/db/migrate/20090517040220_create_uploads.rb +0 -38
- data/test/rails_test/db/migrate/20090602191243_create_muck_raker.rb +0 -322
- data/test/rails_test/db/migrate/20090613173314_create_comments.rb +0 -24
- data/test/rails_test/db/migrate/20090619211125_create_tag_clouds.rb +0 -19
- data/test/rails_test/db/migrate/20090623181458_add_grain_size_to_entries.rb +0 -16
- data/test/rails_test/db/migrate/20090623193525_add_grain_size_to_tag_clouds.rb +0 -12
- data/test/rails_test/db/migrate/20090703055724_add_contents.rb +0 -49
- data/test/rails_test/db/migrate/20090703175825_denormalize_entries_subjects.rb +0 -42
- data/test/rails_test/db/migrate/20090704220055_create_slugs.rb +0 -18
- data/test/rails_test/db/migrate/20090716035935_change_tag_cloud_grain_sizes.rb +0 -9
- data/test/rails_test/db/migrate/20090717173900_add_contributor_to_feeds.rb +0 -9
- data/test/rails_test/db/migrate/20090717175825_normalize_entries_subjects.rb +0 -47
- data/test/rails_test/db/migrate/20090721043213_change_services_title_to_name.rb +0 -9
- data/test/rails_test/db/migrate/20090721054927_remove_services_not_null_from_feeds.rb +0 -9
- data/test/rails_test/db/migrate/20090723050510_create_feed_parents.rb +0 -17
- data/test/rails_test/db/migrate/20090728165716_add_etag_to_feeds.rb +0 -9
- data/test/rails_test/db/migrate/20090730044139_add_comment_cache.rb +0 -9
- data/test/rails_test/db/migrate/20090730045848_add_comment_cache_to_entries.rb +0 -9
- data/test/rails_test/db/migrate/20090730154102_allow_null_user.rb +0 -9
- data/test/rails_test/db/migrate/20090803185323_create_shares.rb +0 -16
- data/test/rails_test/db/migrate/20090804184247_add_comment_count_to_shares.rb +0 -9
- data/test/rails_test/db/migrate/20090804211240_add_entry_id_to_shares.rb +0 -9
- data/test/rails_test/db/migrate/20090804231857_add_shares_uri_index.rb +0 -9
- data/test/rails_test/db/migrate/20090806230610_add_layout_to_contents.rb +0 -9
- data/test/rails_test/db/migrate/20090808175401_add_contents_comment_counter_cache.rb +0 -9
- data/test/rails_test/db/migrate/20090818204527_add_activity_indexes.rb +0 -9
- data/test/rails_test/db/migrate/20090819030523_add_attachable_to_activities.rb +0 -13
- data/test/rails_test/db/migrate/20090826220530_change_services_sequence_to_sort.rb +0 -9
- data/test/rails_test/db/migrate/20090826225652_create_identity_feeds.rb +0 -14
- data/test/rails_test/db/migrate/20090827005105_add_identity_fields_to_services.rb +0 -13
- data/test/rails_test/db/migrate/20090827015308_create_service_categories.rb +0 -12
- data/test/rails_test/db/migrate/20090827221502_add_prompt_and_template_to_services.rb +0 -11
- data/test/rails_test/db/migrate/20090915041650_aggregations_to_polymorphic.rb +0 -15
- data/test/rails_test/db/migrate/20090922174200_update_oai_endpoints.rb +0 -13
- data/test/rails_test/db/migrate/20090922231552_add_dates_to_oai_endpoints.rb +0 -11
- data/test/rails_test/db/migrate/20090923150807_rename_name_in_aggregation.rb +0 -9
- data/test/rails_test/db/migrate/20090924200750_add_uri_data_template_to_services.rb +0 -9
- data/test/rails_test/db/migrate/20091006183742_add_feed_count_to_aggregation.rb +0 -9
- data/test/rails_test/db/migrate/20091022150615_add_uri_key_to_services.rb +0 -9
- data/test/rails_test/db/migrate/20091115011828_add_aggregations_for_personal_recs.rb +0 -9
- data/test/rails_test/db/migrate/20091116094447_rename_action_table.rb +0 -38
- data/test/rails_test/db/migrate/20091118203605_add_default_feed_type_to_aggregation_feed.rb +0 -10
- data/test/rails_test/db/migrate/20091124203137_add_location_to_profiles.rb +0 -15
- data/test/rails_test/db/migrate/20091124205819_add_fields_to_profiles.rb +0 -21
- data/test/rails_test/db/migrate/20100123035450_create_access_codes.rb +0 -19
- data/test/rails_test/db/migrate/20100123233654_create_access_code_requests.rb +0 -14
- data/test/rails_test/db/migrate/20100206000906_remove_name_fields.rb +0 -15
- data/test/rails_test/db/migrate/20100903205928_add_dead_entry_fields.rb +0 -13
- data/test/rails_test/features/step_definitions/common_steps.rb +0 -93
- data/test/rails_test/features/step_definitions/visit_steps.rb +0 -6
- data/test/rails_test/features/step_definitions/web_steps.rb +0 -219
- data/test/rails_test/features/step_definitions/webrat_steps.rb +0 -128
- data/test/rails_test/features/support/custom_env.rb +0 -19
- data/test/rails_test/features/support/env.rb +0 -58
- data/test/rails_test/features/support/paths.rb +0 -33
- data/test/rails_test/lib/daemons/amazonaws.rb +0 -36
- data/test/rails_test/public/dispatch.rb +0 -10
- data/test/rails_test/spec/controllers/admin/feeds_controller_spec.rb +0 -38
- data/test/rails_test/spec/controllers/admin/oai_endpoints_controller_spec.rb +0 -30
- data/test/rails_test/spec/controllers/aggregation_feeds_controller_spec.rb +0 -67
- data/test/rails_test/spec/controllers/aggregations_controller_spec.rb +0 -89
- data/test/rails_test/spec/controllers/feed_previews_controller_spec.rb +0 -32
- data/test/rails_test/spec/controllers/feeds_controller_spec.rb +0 -78
- data/test/rails_test/spec/controllers/identity_feeds_controller_spec.rb +0 -110
- data/test/rails_test/spec/controllers/oai_endpoints_controller_spec.rb +0 -42
- data/test/rails_test/spec/controllers/topics_controller_spec.rb +0 -50
- data/test/rails_test/spec/controllers/visits_controller_spec.rb +0 -21
- data/test/rails_test/spec/factories.rb +0 -16
- data/test/rails_test/spec/mailers/services_mailer_spec.rb +0 -31
- data/test/rails_test/spec/models/aggregation_feed_spec.rb +0 -23
- data/test/rails_test/spec/models/aggregation_spec.rb +0 -87
- data/test/rails_test/spec/models/entry_spec.rb +0 -195
- data/test/rails_test/spec/models/feed_parent_spec.rb +0 -22
- data/test/rails_test/spec/models/feed_spec.rb +0 -204
- data/test/rails_test/spec/models/identity_feed_spec.rb +0 -18
- data/test/rails_test/spec/models/oai_endpoint_spec.rb +0 -78
- data/test/rails_test/spec/models/personal_recommendation_spec.rb +0 -60
- data/test/rails_test/spec/models/recommendation_spec.rb +0 -27
- data/test/rails_test/spec/models/service_category_spec.rb +0 -19
- data/test/rails_test/spec/models/service_spec.rb +0 -383
- data/test/rails_test/spec/models/share_spec.rb +0 -30
- data/test/rails_test/spec/models/tag_cloud_spec.rb +0 -23
- data/test/rails_test/spec/models/user_spec.rb +0 -45
- data/test/rails_test/spec/spec_helper.rb +0 -36
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
-
|
|
3
|
-
describe PersonalRecommendation do
|
|
4
|
-
describe "personal recommendations" do
|
|
5
|
-
before do
|
|
6
|
-
@user = Factory(:user)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
describe "include MuckServices::Models::MuckRecommendationOwner" do
|
|
10
|
-
before do
|
|
11
|
-
@entry = Factory(:entry)
|
|
12
|
-
end
|
|
13
|
-
it "should create a personal recommendation" do
|
|
14
|
-
recommendation = @user.personal_recommendations.build(:destination => @entry)
|
|
15
|
-
recommendation.save.should be_true
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe "include MuckServices::Models::MuckRecommendation" do
|
|
20
|
-
before do
|
|
21
|
-
@recommended_user = Factory(:user)
|
|
22
|
-
end
|
|
23
|
-
it "should make user recommended" do
|
|
24
|
-
recommendation = @user.personal_recommendations.create(:destination => @recommended_user)
|
|
25
|
-
@recommended_user.recommended_to.should include(recommendation)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
describe "named scopes" do
|
|
30
|
-
before do
|
|
31
|
-
@entry = Factory(:entry)
|
|
32
|
-
@entry_old = Factory(:entry)
|
|
33
|
-
@recommended_user = Factory(:user)
|
|
34
|
-
@entry_recommendation = @user.personal_recommendations.create(:destination => @entry)
|
|
35
|
-
@user_recommendation = @user.personal_recommendations.create(:destination => @recommended_user, :created_at => 1.day.ago)
|
|
36
|
-
@old_recommendation = @user.personal_recommendations.create(:destination => @entry_old, :created_at => 3.weeks.ago)
|
|
37
|
-
end
|
|
38
|
-
it { should scope_newer_than }
|
|
39
|
-
it { should scope_by_newest }
|
|
40
|
-
|
|
41
|
-
describe "entries" do
|
|
42
|
-
it "should return an entry" do
|
|
43
|
-
@user.personal_recommendations.entries_only.should include(@entry_recommendation)
|
|
44
|
-
end
|
|
45
|
-
it "should not return a user" do
|
|
46
|
-
@user.personal_recommendations.entries_only.should_not include(@user_recommendation)
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
describe "users" do
|
|
50
|
-
it "should return an user" do
|
|
51
|
-
@user.personal_recommendations.users.should include(@user_recommendation)
|
|
52
|
-
end
|
|
53
|
-
it "should not return an entry" do
|
|
54
|
-
@user.personal_recommendations.users.should_not include(@entry_recommendation)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
end
|
|
60
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# == Schema Information
|
|
2
|
-
#
|
|
3
|
-
# Table name: recommendations
|
|
4
|
-
#
|
|
5
|
-
# id :integer(4) not null, primary key
|
|
6
|
-
# entry_id :integer(4)
|
|
7
|
-
# dest_entry_id :integer(4)
|
|
8
|
-
# rank :integer(4)
|
|
9
|
-
# relevance :decimal(8, 6) default(0.0)
|
|
10
|
-
# clicks :integer(4) default(0)
|
|
11
|
-
# avg_time_at_dest :integer(4) default(60)
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
15
|
-
|
|
16
|
-
describe Recommendation do
|
|
17
|
-
|
|
18
|
-
describe "recommendation" do
|
|
19
|
-
before do
|
|
20
|
-
@recommendation = Factory(:recommendation)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it { should belong_to :entry }
|
|
24
|
-
it { should belong_to :dest_entry }
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# == Schema Information
|
|
2
|
-
#
|
|
3
|
-
# Table name: service_categories
|
|
4
|
-
#
|
|
5
|
-
# id :integer(4) not null, primary key
|
|
6
|
-
# name :string(255) not null
|
|
7
|
-
# sort :integer(4) default(0)
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
11
|
-
|
|
12
|
-
describe ServiceCategory do
|
|
13
|
-
|
|
14
|
-
describe "service category instance" do
|
|
15
|
-
it { should have_many :services }
|
|
16
|
-
it { should scope_sorted }
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
end
|
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
# == Schema Information
|
|
2
|
-
#
|
|
3
|
-
# Table name: services
|
|
4
|
-
#
|
|
5
|
-
# id :integer(4) not null, primary key
|
|
6
|
-
# uri :string(2083) default("")
|
|
7
|
-
# name :string(1000) default("")
|
|
8
|
-
# api_uri :string(2083) default("")
|
|
9
|
-
# uri_template :string(2083) default("")
|
|
10
|
-
# icon :string(2083) default("rss.gif")
|
|
11
|
-
# sort :integer(4)
|
|
12
|
-
# requires_password :boolean(1)
|
|
13
|
-
# use_for :string(255)
|
|
14
|
-
# service_category_id :integer(4)
|
|
15
|
-
# active :boolean(1) default(TRUE)
|
|
16
|
-
# prompt :string(255)
|
|
17
|
-
# template :string(255)
|
|
18
|
-
# uri_data_template :string(2083) default("")
|
|
19
|
-
# uri_key :string(255)
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
|
23
|
-
|
|
24
|
-
describe Service do
|
|
25
|
-
|
|
26
|
-
describe "service instance" do
|
|
27
|
-
|
|
28
|
-
it { should belong_to :service_category }
|
|
29
|
-
it { should scope_sorted }
|
|
30
|
-
it { should scope_sorted_id }
|
|
31
|
-
|
|
32
|
-
describe "named scope" do
|
|
33
|
-
describe "identity_services" do
|
|
34
|
-
before do
|
|
35
|
-
@service = Factory(:service, :use_for => 'identity')
|
|
36
|
-
@service_not = Factory(:service, :use_for => 'not')
|
|
37
|
-
end
|
|
38
|
-
it "should find services that have use_for=='identity_services'" do
|
|
39
|
-
Service.identity_services.should include(@service)
|
|
40
|
-
end
|
|
41
|
-
it "should not find services that where use_for!='identity_services'" do
|
|
42
|
-
Service.identity_services.should_not include(@service_not)
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
describe "tag_services" do
|
|
46
|
-
before do
|
|
47
|
-
@service = Factory(:service, :use_for => 'tags')
|
|
48
|
-
@service_not = Factory(:service, :use_for => 'not')
|
|
49
|
-
end
|
|
50
|
-
it "should find services that have use_for=='tags'" do
|
|
51
|
-
Service.tag_services.should include(@service)
|
|
52
|
-
end
|
|
53
|
-
it "should not find services that where use_for!='tags'" do
|
|
54
|
-
Service.tag_services.should_not include(@service_not)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
describe "sorted_id" do
|
|
58
|
-
before do
|
|
59
|
-
Service.delete_all
|
|
60
|
-
@first = Factory(:service)
|
|
61
|
-
@second = Factory(:service)
|
|
62
|
-
end
|
|
63
|
-
it "should sort by 'sort' field" do
|
|
64
|
-
Service.sorted_id[0].should == @first
|
|
65
|
-
Service.sorted_id[1].should == @second
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
describe "photo_services" do
|
|
69
|
-
before do
|
|
70
|
-
@service_category = Factory(:service_category, :name => 'Photos')
|
|
71
|
-
@service = Factory(:service, :service_category => @service_category)
|
|
72
|
-
@service_not = Factory(:service)
|
|
73
|
-
end
|
|
74
|
-
it "should find services that have 'Photos' for a service category" do
|
|
75
|
-
Service.photo_services.should include(@service)
|
|
76
|
-
end
|
|
77
|
-
it "should not find services that don't have 'Photos' for a service category" do
|
|
78
|
-
Service.photo_services.should_not include(@service_not)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
describe "photos" do
|
|
84
|
-
before do
|
|
85
|
-
service_category = Factory(:service_category, :name => 'Photos')
|
|
86
|
-
@service = Factory(:service, :service_category_id => service_category.id)
|
|
87
|
-
end
|
|
88
|
-
it "should be a photo service" do
|
|
89
|
-
@service.photo?(true).should be_true
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
describe "videos" do
|
|
94
|
-
before do
|
|
95
|
-
service_category = Factory(:service_category, :name => 'Videos')
|
|
96
|
-
@service = Factory(:service, :service_category_id => service_category.id)
|
|
97
|
-
end
|
|
98
|
-
it "should be a video service" do
|
|
99
|
-
@service.video?(true).should be_true
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
describe "bookmarks" do
|
|
104
|
-
before do
|
|
105
|
-
service_category = Factory(:service_category, :name => 'Bookmarks')
|
|
106
|
-
@service = Factory(:service, :service_category_id => service_category.id)
|
|
107
|
-
end
|
|
108
|
-
it "should be a bookmark service" do
|
|
109
|
-
@service.bookmark?(true).should be_true
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
describe "music" do
|
|
114
|
-
before do
|
|
115
|
-
service_category = Factory(:service_category, :name => 'Music')
|
|
116
|
-
@service = Factory(:service, :service_category_id => service_category.id)
|
|
117
|
-
end
|
|
118
|
-
it "should be a music service" do
|
|
119
|
-
@service.music?(true).should be_true
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
describe "news" do
|
|
124
|
-
before do
|
|
125
|
-
service_category = Factory(:service_category, :name => 'News')
|
|
126
|
-
@service = Factory(:service, :service_category_id => service_category.id)
|
|
127
|
-
end
|
|
128
|
-
it "should be a news service" do
|
|
129
|
-
@service.news?(true).should be_true
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
describe "blog" do
|
|
134
|
-
before do
|
|
135
|
-
service_category = Factory(:service_category, :name => 'Blogging')
|
|
136
|
-
@service = Factory(:service, :service_category_id => service_category.id)
|
|
137
|
-
end
|
|
138
|
-
it "should be a blog service" do
|
|
139
|
-
@service.blog?(true).should be_true
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
describe "search" do
|
|
144
|
-
before do
|
|
145
|
-
service_category = Factory(:service_category, :name => 'Search')
|
|
146
|
-
@service = Factory(:service, :service_category_id => service_category.id)
|
|
147
|
-
end
|
|
148
|
-
it "should be a search service" do
|
|
149
|
-
@service.search?(true).should be_true
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
describe "general" do
|
|
154
|
-
before do
|
|
155
|
-
service_category = Factory(:service_category, :name => 'RSS')
|
|
156
|
-
@service = Factory(:service, :service_category_id => service_category.id)
|
|
157
|
-
end
|
|
158
|
-
it "should be a general service" do
|
|
159
|
-
@service.general?(true).should be_true
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
describe "identity services" do
|
|
166
|
-
it "should generate uri using blog url" do
|
|
167
|
-
service = Factory(:service)
|
|
168
|
-
uris = service.generate_uris('', '', TEST_URI)
|
|
169
|
-
uris.map(&:url).include?(TEST_RSS_URI).should be_true
|
|
170
|
-
end
|
|
171
|
-
it "should generate uri using username" do
|
|
172
|
-
service = Factory(:service, :uri_data_template => TEST_USERNAME_TEMPLATE)
|
|
173
|
-
uris = service.generate_uris('jbasdf', '', '')
|
|
174
|
-
uris.map(&:url).include?(TEST_USERNAME_TEMPLATE.sub('{username}', 'jbasdf')).should be_true
|
|
175
|
-
end
|
|
176
|
-
it "should get twitter uri from username" do
|
|
177
|
-
service = Factory(:service, :uri_data_template => "http://www.twitter.com/{username}")
|
|
178
|
-
uris = service.generate_uris('jbasdf', '', '')
|
|
179
|
-
uris.map(&:url).include?("http://twitter.com/statuses/user_timeline/7219042.rss").should be_true
|
|
180
|
-
end
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
describe "tag services" do
|
|
184
|
-
before do
|
|
185
|
-
@user = Factory(:user)
|
|
186
|
-
@template = "http://example.com/{tag}.rss"
|
|
187
|
-
@uri_template = "http://example.com/{tag}"
|
|
188
|
-
@service = Factory(:service, :uri_data_template => @template, :uri_template => @uri_template, :use_for => 'tags')
|
|
189
|
-
end
|
|
190
|
-
it "should generate urls for tag" do
|
|
191
|
-
tag = 'rails'
|
|
192
|
-
uris = Service.generate_tag_uris(tag)
|
|
193
|
-
uris.should include(@template.sub('{tag}', tag))
|
|
194
|
-
end
|
|
195
|
-
it "should set display uri when building a feed" do
|
|
196
|
-
tag = 'identity'
|
|
197
|
-
feeds = Service.build_tag_feeds(tag, @user, nil, true)
|
|
198
|
-
feeds.any?{|feed| feed.display_uri == (@uri_template.sub('{tag}', tag))}.should be_true
|
|
199
|
-
end
|
|
200
|
-
it "should build a feed for every tag service" do
|
|
201
|
-
tag = 'cycling'
|
|
202
|
-
feeds = Service.build_tag_feeds(tag, @user, nil, true)
|
|
203
|
-
feeds.length.should == Service.tag_services.length
|
|
204
|
-
feeds.any?{|feed| feed.uri == (@template.sub('{tag}', tag))}.should be_true
|
|
205
|
-
end
|
|
206
|
-
it "should build a limited number of feeds for tag" do
|
|
207
|
-
tag = 'ruby'
|
|
208
|
-
feeds = Service.build_tag_feeds(tag, @user, [@service.id], true)
|
|
209
|
-
feeds.length.should == 1
|
|
210
|
-
feeds.any?{|feed| feed.uri == (@template.sub('{tag}', tag))}.should be_true
|
|
211
|
-
end
|
|
212
|
-
it "should create a feed for every tag service" do
|
|
213
|
-
tag = 'physics'
|
|
214
|
-
feeds = Service.create_tag_feeds(tag, @user, nil, true)
|
|
215
|
-
feeds.length.should == Service.tag_services.length
|
|
216
|
-
feeds.any?{|feed| feed.uri == (@template.sub('{tag}', tag))}.should be_true
|
|
217
|
-
end
|
|
218
|
-
it "should create a limited number of feeds for tag" do
|
|
219
|
-
tag = 'math'
|
|
220
|
-
feeds = Service.create_tag_feeds(tag, @user, [@service.id], true)
|
|
221
|
-
feeds.length.should == 1
|
|
222
|
-
feeds.any?{|feed| feed.uri.should == (@template.sub('{tag}', tag))}
|
|
223
|
-
end
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
describe "Create feed from service" do
|
|
227
|
-
before do
|
|
228
|
-
@login = 'jbasdf'
|
|
229
|
-
@password = ''
|
|
230
|
-
@uri_data_template = TEST_USERNAME_TEMPLATE
|
|
231
|
-
@service = Factory(:service, :uri_data_template => @uri_data_template)
|
|
232
|
-
@user = Factory(:user)
|
|
233
|
-
end
|
|
234
|
-
it "should create feed from service" do
|
|
235
|
-
feeds = Service.create_tag_feeds_for_service(@service, '', @login, @password, @user.id)
|
|
236
|
-
feed = feeds[0]
|
|
237
|
-
feed.uri.should == @uri_data_template.sub("{username}", @login)
|
|
238
|
-
feed.login.should == @login
|
|
239
|
-
feed.password.should == @password
|
|
240
|
-
feed.service_id.should == @service.id
|
|
241
|
-
end
|
|
242
|
-
it "should create feed from service even with nil template" do
|
|
243
|
-
feeds = Service.create_tag_feeds_for_service(@service, '', @login, @password, @user.id)
|
|
244
|
-
feed = feeds[0]
|
|
245
|
-
feed.uri.should == @uri_data_template.sub("{username}", @login)
|
|
246
|
-
feed.login.should == @login
|
|
247
|
-
feed.password.should == @password
|
|
248
|
-
feed.service_id.should == @service.id
|
|
249
|
-
end
|
|
250
|
-
end
|
|
251
|
-
|
|
252
|
-
describe "Find service by uri" do
|
|
253
|
-
before do
|
|
254
|
-
Service.delete_all
|
|
255
|
-
end
|
|
256
|
-
after do
|
|
257
|
-
bootstrap_services
|
|
258
|
-
end
|
|
259
|
-
it "should find service when uri is shorter" do
|
|
260
|
-
foo_service = Factory(:service, :uri => 'http://www.foo.com')
|
|
261
|
-
service = Service.find_service_by_uri('foo.com', true)
|
|
262
|
-
service.should == foo_service
|
|
263
|
-
end
|
|
264
|
-
it "should find service uri is longer" do
|
|
265
|
-
example_service = Factory(:service, :uri => 'http://www.example.com')
|
|
266
|
-
service = Service.find_service_by_uri('http://www.example.com/other_stuff', true)
|
|
267
|
-
service.should == example_service
|
|
268
|
-
end
|
|
269
|
-
end
|
|
270
|
-
|
|
271
|
-
describe "build" do
|
|
272
|
-
before do
|
|
273
|
-
@terms = "ruby"
|
|
274
|
-
@user = Factory(:user)
|
|
275
|
-
end
|
|
276
|
-
describe "photo feeds" do
|
|
277
|
-
before do
|
|
278
|
-
@feeds = Service.build_photo_feeds(@terms, @user.id)
|
|
279
|
-
end
|
|
280
|
-
it "should only create photo feeds" do
|
|
281
|
-
assert @feeds.length > 0
|
|
282
|
-
@feeds.all? { |feed| feed.service.service_category.name == "Photos" }.should be_true
|
|
283
|
-
end
|
|
284
|
-
end
|
|
285
|
-
describe "video feeds" do
|
|
286
|
-
before do
|
|
287
|
-
@feeds = Service.build_video_feeds(@terms, @user.id)
|
|
288
|
-
end
|
|
289
|
-
it "should only create video feeds" do
|
|
290
|
-
assert @feeds.length > 0
|
|
291
|
-
@feeds.all? { |feed| feed.service.service_category.name == "Videos" }.should be_true
|
|
292
|
-
end
|
|
293
|
-
end
|
|
294
|
-
describe "bookmark feeds" do
|
|
295
|
-
before do
|
|
296
|
-
@feeds = Service.build_bookmark_feeds(@terms, @user.id)
|
|
297
|
-
end
|
|
298
|
-
it "should only create bookmark feeds" do
|
|
299
|
-
assert @feeds.length > 0
|
|
300
|
-
@feeds.all? { |feed| feed.service.service_category.name == "Bookmarks" }.should be_true
|
|
301
|
-
end
|
|
302
|
-
end
|
|
303
|
-
describe "music feeds" do
|
|
304
|
-
before do
|
|
305
|
-
build_music_service
|
|
306
|
-
@feeds = Service.build_music_feeds(@terms, @user.id, nil, true) # We build the music service above so we have to force a cache refresh
|
|
307
|
-
end
|
|
308
|
-
it "should only create music feeds" do
|
|
309
|
-
assert @feeds.length > 0
|
|
310
|
-
@feeds.all? { |feed| feed.service.service_category.name == "Music" }.should be_true
|
|
311
|
-
end
|
|
312
|
-
end
|
|
313
|
-
describe "news feeds" do
|
|
314
|
-
before do
|
|
315
|
-
@feeds = Service.build_news_feeds(@terms, @user.id, nil, true) # We build the news service above so we have to force a cache refresh
|
|
316
|
-
end
|
|
317
|
-
it "should only create news feeds" do
|
|
318
|
-
assert @feeds.length > 0
|
|
319
|
-
@feeds.all? { |feed| feed.service.service_category.name == "News" }.should be_true
|
|
320
|
-
end
|
|
321
|
-
end
|
|
322
|
-
describe "blog feeds" do
|
|
323
|
-
before do
|
|
324
|
-
@feeds = Service.build_blog_feeds(@terms, @user.id, nil, true) # We build the blog service above so we have to force a cache refresh
|
|
325
|
-
end
|
|
326
|
-
it "should only create blog feeds" do
|
|
327
|
-
assert @feeds.length > 0
|
|
328
|
-
@feeds.all? { |feed| feed.service.service_category.name == "Blogging" }.should be_true
|
|
329
|
-
end
|
|
330
|
-
end
|
|
331
|
-
describe "search feeds" do
|
|
332
|
-
before do
|
|
333
|
-
@feeds = Service.build_search_feeds(@terms, @user.id, nil, true) # We build the search service above so we have to force a cache refresh
|
|
334
|
-
end
|
|
335
|
-
it "should only create search feeds" do
|
|
336
|
-
assert @feeds.length > 0
|
|
337
|
-
@feeds.all? { |feed| feed.service.service_category.name == "Search" }.should be_true
|
|
338
|
-
end
|
|
339
|
-
end
|
|
340
|
-
end
|
|
341
|
-
|
|
342
|
-
describe "service types" do
|
|
343
|
-
before do
|
|
344
|
-
build_music_service
|
|
345
|
-
end
|
|
346
|
-
it "should get photo services" do
|
|
347
|
-
assert Service.get_photo_tag_services(true).length > 0
|
|
348
|
-
Service.get_photo_tag_services.all? { |service| service.service_category.name == "Photos" }.should be_true
|
|
349
|
-
end
|
|
350
|
-
it "should get video services" do
|
|
351
|
-
assert Service.get_video_tag_services(true).length > 0
|
|
352
|
-
Service.get_video_tag_services.all? { |service| service.service_category.name == "Videos" }.should be_true
|
|
353
|
-
end
|
|
354
|
-
it "should get bookmark services" do
|
|
355
|
-
assert Service.get_bookmark_tag_services(true).length > 0
|
|
356
|
-
Service.get_bookmark_tag_services.all? { |service| service.service_category.name == "Bookmarks" }.should be_true
|
|
357
|
-
end
|
|
358
|
-
it "should get music services" do
|
|
359
|
-
assert Service.get_music_tag_services(true).length > 0
|
|
360
|
-
Service.get_music_tag_services.all? { |service| service.service_category.name == "Music" }.should be_true
|
|
361
|
-
end
|
|
362
|
-
it "should get news services" do
|
|
363
|
-
assert Service.get_news_tag_services(true).length > 0
|
|
364
|
-
Service.get_news_tag_services.all? { |service| service.service_category.name == "News" }.should be_true
|
|
365
|
-
end
|
|
366
|
-
it "should get blog services" do
|
|
367
|
-
assert Service.get_blog_tag_services(true).length > 0
|
|
368
|
-
Service.get_blog_tag_services.all? { |service| service.service_category.name == "Blogging" }.should be_true
|
|
369
|
-
end
|
|
370
|
-
it "should get search services" do
|
|
371
|
-
assert Service.get_search_tag_services(true).length > 0
|
|
372
|
-
Service.get_search_tag_services.all? { |service| service.service_category.name == "Search" }.should be_true
|
|
373
|
-
end
|
|
374
|
-
it "should get general services" do
|
|
375
|
-
assert Service.get_general_tag_services(true).length > 0
|
|
376
|
-
Service.get_general_tag_services.any? { |service| service.service_category.name == "Photos" }.should_not be_true
|
|
377
|
-
Service.get_general_tag_services.any? { |service| service.service_category.name == "Videos" }.should_not be_true
|
|
378
|
-
Service.get_general_tag_services.any? { |service| service.service_category.name == "Bookmarks" }.should_not be_true
|
|
379
|
-
Service.get_general_tag_services.any? { |service| service.service_category.name == "Music" }.should_not be_true
|
|
380
|
-
end
|
|
381
|
-
end
|
|
382
|
-
|
|
383
|
-
end
|