muck-services 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/Rakefile +6 -9
  2. data/VERSION +1 -1
  3. data/muck-services.gemspec +241 -362
  4. metadata +9 -241
  5. data/.gitignore +0 -30
  6. data/test/rails_test/app/controllers/application_controller.rb +0 -24
  7. data/test/rails_test/app/controllers/default_controller.rb +0 -7
  8. data/test/rails_test/app/helpers/application_helper.rb +0 -3
  9. data/test/rails_test/app/models/activity.rb +0 -24
  10. data/test/rails_test/app/models/comment.rb +0 -23
  11. data/test/rails_test/app/models/country.rb +0 -13
  12. data/test/rails_test/app/models/language.rb +0 -15
  13. data/test/rails_test/app/models/share.rb +0 -20
  14. data/test/rails_test/app/models/state.rb +0 -13
  15. data/test/rails_test/app/models/user.rb +0 -45
  16. data/test/rails_test/app/models/user_session.rb +0 -2
  17. data/test/rails_test/config/application.rb +0 -42
  18. data/test/rails_test/config/boot.rb +0 -13
  19. data/test/rails_test/config/environment.rb +0 -5
  20. data/test/rails_test/config/environments/development.rb +0 -26
  21. data/test/rails_test/config/environments/production.rb +0 -49
  22. data/test/rails_test/config/environments/test.rb +0 -35
  23. data/test/rails_test/config/initializers/backtrace_silencers.rb +0 -7
  24. data/test/rails_test/config/initializers/inflections.rb +0 -10
  25. data/test/rails_test/config/initializers/mce_options.rb +0 -83
  26. data/test/rails_test/config/initializers/mime_types.rb +0 -5
  27. data/test/rails_test/config/initializers/muck.rb +0 -66
  28. data/test/rails_test/config/initializers/secret_token.rb +0 -7
  29. data/test/rails_test/config/initializers/session_store.rb +0 -8
  30. data/test/rails_test/config/routes.rb +0 -12
  31. data/test/rails_test/db/migrate/20090320174818_create_muck_permissions_and_roles.rb +0 -16
  32. data/test/rails_test/db/migrate/20090327231918_create_users.rb +0 -40
  33. data/test/rails_test/db/migrate/20090402033319_add_muck_activities.rb +0 -36
  34. data/test/rails_test/db/migrate/20090402234137_create_languages.rb +0 -18
  35. data/test/rails_test/db/migrate/20090426041056_create_countries.rb +0 -15
  36. data/test/rails_test/db/migrate/20090426041103_create_states.rb +0 -18
  37. data/test/rails_test/db/migrate/20090512013727_create_profiles.rb +0 -21
  38. data/test/rails_test/db/migrate/20090517040220_create_uploads.rb +0 -38
  39. data/test/rails_test/db/migrate/20090602191243_create_muck_raker.rb +0 -322
  40. data/test/rails_test/db/migrate/20090613173314_create_comments.rb +0 -24
  41. data/test/rails_test/db/migrate/20090619211125_create_tag_clouds.rb +0 -19
  42. data/test/rails_test/db/migrate/20090623181458_add_grain_size_to_entries.rb +0 -16
  43. data/test/rails_test/db/migrate/20090623193525_add_grain_size_to_tag_clouds.rb +0 -12
  44. data/test/rails_test/db/migrate/20090703055724_add_contents.rb +0 -49
  45. data/test/rails_test/db/migrate/20090703175825_denormalize_entries_subjects.rb +0 -42
  46. data/test/rails_test/db/migrate/20090704220055_create_slugs.rb +0 -18
  47. data/test/rails_test/db/migrate/20090716035935_change_tag_cloud_grain_sizes.rb +0 -9
  48. data/test/rails_test/db/migrate/20090717173900_add_contributor_to_feeds.rb +0 -9
  49. data/test/rails_test/db/migrate/20090717175825_normalize_entries_subjects.rb +0 -47
  50. data/test/rails_test/db/migrate/20090721043213_change_services_title_to_name.rb +0 -9
  51. data/test/rails_test/db/migrate/20090721054927_remove_services_not_null_from_feeds.rb +0 -9
  52. data/test/rails_test/db/migrate/20090723050510_create_feed_parents.rb +0 -17
  53. data/test/rails_test/db/migrate/20090728165716_add_etag_to_feeds.rb +0 -9
  54. data/test/rails_test/db/migrate/20090730044139_add_comment_cache.rb +0 -9
  55. data/test/rails_test/db/migrate/20090730045848_add_comment_cache_to_entries.rb +0 -9
  56. data/test/rails_test/db/migrate/20090730154102_allow_null_user.rb +0 -9
  57. data/test/rails_test/db/migrate/20090803185323_create_shares.rb +0 -16
  58. data/test/rails_test/db/migrate/20090804184247_add_comment_count_to_shares.rb +0 -9
  59. data/test/rails_test/db/migrate/20090804211240_add_entry_id_to_shares.rb +0 -9
  60. data/test/rails_test/db/migrate/20090804231857_add_shares_uri_index.rb +0 -9
  61. data/test/rails_test/db/migrate/20090806230610_add_layout_to_contents.rb +0 -9
  62. data/test/rails_test/db/migrate/20090808175401_add_contents_comment_counter_cache.rb +0 -9
  63. data/test/rails_test/db/migrate/20090818204527_add_activity_indexes.rb +0 -9
  64. data/test/rails_test/db/migrate/20090819030523_add_attachable_to_activities.rb +0 -13
  65. data/test/rails_test/db/migrate/20090826220530_change_services_sequence_to_sort.rb +0 -9
  66. data/test/rails_test/db/migrate/20090826225652_create_identity_feeds.rb +0 -14
  67. data/test/rails_test/db/migrate/20090827005105_add_identity_fields_to_services.rb +0 -13
  68. data/test/rails_test/db/migrate/20090827015308_create_service_categories.rb +0 -12
  69. data/test/rails_test/db/migrate/20090827221502_add_prompt_and_template_to_services.rb +0 -11
  70. data/test/rails_test/db/migrate/20090915041650_aggregations_to_polymorphic.rb +0 -15
  71. data/test/rails_test/db/migrate/20090922174200_update_oai_endpoints.rb +0 -13
  72. data/test/rails_test/db/migrate/20090922231552_add_dates_to_oai_endpoints.rb +0 -11
  73. data/test/rails_test/db/migrate/20090923150807_rename_name_in_aggregation.rb +0 -9
  74. data/test/rails_test/db/migrate/20090924200750_add_uri_data_template_to_services.rb +0 -9
  75. data/test/rails_test/db/migrate/20091006183742_add_feed_count_to_aggregation.rb +0 -9
  76. data/test/rails_test/db/migrate/20091022150615_add_uri_key_to_services.rb +0 -9
  77. data/test/rails_test/db/migrate/20091115011828_add_aggregations_for_personal_recs.rb +0 -9
  78. data/test/rails_test/db/migrate/20091116094447_rename_action_table.rb +0 -38
  79. data/test/rails_test/db/migrate/20091118203605_add_default_feed_type_to_aggregation_feed.rb +0 -10
  80. data/test/rails_test/db/migrate/20091124203137_add_location_to_profiles.rb +0 -15
  81. data/test/rails_test/db/migrate/20091124205819_add_fields_to_profiles.rb +0 -21
  82. data/test/rails_test/db/migrate/20100123035450_create_access_codes.rb +0 -19
  83. data/test/rails_test/db/migrate/20100123233654_create_access_code_requests.rb +0 -14
  84. data/test/rails_test/db/migrate/20100206000906_remove_name_fields.rb +0 -15
  85. data/test/rails_test/db/migrate/20100903205928_add_dead_entry_fields.rb +0 -13
  86. data/test/rails_test/features/step_definitions/common_steps.rb +0 -93
  87. data/test/rails_test/features/step_definitions/visit_steps.rb +0 -6
  88. data/test/rails_test/features/step_definitions/web_steps.rb +0 -219
  89. data/test/rails_test/features/step_definitions/webrat_steps.rb +0 -128
  90. data/test/rails_test/features/support/custom_env.rb +0 -19
  91. data/test/rails_test/features/support/env.rb +0 -58
  92. data/test/rails_test/features/support/paths.rb +0 -33
  93. data/test/rails_test/lib/daemons/amazonaws.rb +0 -36
  94. data/test/rails_test/public/dispatch.rb +0 -10
  95. data/test/rails_test/spec/controllers/admin/feeds_controller_spec.rb +0 -38
  96. data/test/rails_test/spec/controllers/admin/oai_endpoints_controller_spec.rb +0 -30
  97. data/test/rails_test/spec/controllers/aggregation_feeds_controller_spec.rb +0 -67
  98. data/test/rails_test/spec/controllers/aggregations_controller_spec.rb +0 -89
  99. data/test/rails_test/spec/controllers/feed_previews_controller_spec.rb +0 -32
  100. data/test/rails_test/spec/controllers/feeds_controller_spec.rb +0 -78
  101. data/test/rails_test/spec/controllers/identity_feeds_controller_spec.rb +0 -110
  102. data/test/rails_test/spec/controllers/oai_endpoints_controller_spec.rb +0 -42
  103. data/test/rails_test/spec/controllers/topics_controller_spec.rb +0 -50
  104. data/test/rails_test/spec/controllers/visits_controller_spec.rb +0 -21
  105. data/test/rails_test/spec/factories.rb +0 -16
  106. data/test/rails_test/spec/mailers/services_mailer_spec.rb +0 -31
  107. data/test/rails_test/spec/models/aggregation_feed_spec.rb +0 -23
  108. data/test/rails_test/spec/models/aggregation_spec.rb +0 -87
  109. data/test/rails_test/spec/models/entry_spec.rb +0 -195
  110. data/test/rails_test/spec/models/feed_parent_spec.rb +0 -22
  111. data/test/rails_test/spec/models/feed_spec.rb +0 -204
  112. data/test/rails_test/spec/models/identity_feed_spec.rb +0 -18
  113. data/test/rails_test/spec/models/oai_endpoint_spec.rb +0 -78
  114. data/test/rails_test/spec/models/personal_recommendation_spec.rb +0 -60
  115. data/test/rails_test/spec/models/recommendation_spec.rb +0 -27
  116. data/test/rails_test/spec/models/service_category_spec.rb +0 -19
  117. data/test/rails_test/spec/models/service_spec.rb +0 -383
  118. data/test/rails_test/spec/models/share_spec.rb +0 -30
  119. data/test/rails_test/spec/models/tag_cloud_spec.rb +0 -23
  120. data/test/rails_test/spec/models/user_spec.rb +0 -45
  121. data/test/rails_test/spec/spec_helper.rb +0 -36
@@ -1,195 +0,0 @@
1
- # == Schema Information
2
- #
3
- # Table name: entries
4
- #
5
- # id :integer(4) not null, primary key
6
- # feed_id :integer(4) not null
7
- # permalink :string(2083) default(""), not null
8
- # author :string(2083)
9
- # title :text default(""), not null
10
- # description :text
11
- # content :text
12
- # unique_content :boolean(1)
13
- # published_at :datetime not null
14
- # entry_updated_at :datetime
15
- # harvested_at :datetime
16
- # oai_identifier :string(2083)
17
- # language_id :integer(4)
18
- # direct_link :string(2083)
19
- # indexed_at :datetime default(Fri Jan 01 01:01:01 UTC 1971), not null
20
- # relevance_calculated_at :datetime default(Fri Jan 01 01:01:01 UTC 1971), not null
21
- # popular :text
22
- # relevant :text
23
- # other :text
24
- # grain_size :string(255) default("unknown")
25
- # comment_count :integer(4) default(0)
26
- #
27
-
28
- require File.dirname(__FILE__) + '/../spec_helper'
29
-
30
- describe Entry do
31
-
32
- describe "entry instance" do
33
- before do
34
- @entry = Factory(:entry)
35
- end
36
-
37
- it { should belong_to :feed }
38
-
39
- describe "recommender_entry" do
40
- it "should return an entry if the direct_link matches the specified uri" do
41
- uri = Factory.next(:uri)
42
- e = Factory.create(:entry, :direct_link => uri)
43
- Entry.recommender_entry(uri).id.should == e.id
44
- end
45
-
46
- it "should return an entry if the permalink matches the specified uri" do
47
- uri = Factory.next(:uri)
48
- e = Factory.create(:entry, :permalink => uri)
49
- Entry.recommender_entry(uri).id.should == e.id
50
- end
51
-
52
- it "should return an empty entry with the specified uri if the specified uri doesn't match" do
53
- uri = Factory.next(:uri)
54
- e = Factory.create(:entry, :permalink => uri)
55
- Entry.recommender_entry(uri).should_not be_nil
56
- Entry.recommender_entry(uri).permalink.should == uri
57
- end
58
- end
59
-
60
- describe "resource_uri" do
61
- it "should return the permalink when no direct_link is specified" do
62
- @entry.direct_link = nil
63
- @entry.resource_uri.should == @entry.permalink
64
- end
65
-
66
- it "should return the direct_link when a direct_link is specified" do
67
- @entry.direct_link = Factory.next(:uri)
68
- @entry.resource_uri.should == @entry.direct_link
69
- end
70
- end
71
-
72
- describe "search" do
73
- # it "should search indexes for ruby" do
74
- # Entry.search('ruby', 'all', 'en', 10, 0)
75
- # end
76
- it "should raise invalid language error" do
77
- lambda{
78
- Entry.search('ruby', 'all', 'foo', 10, 0)
79
- }.should raise_error(MuckServices::Exceptions::LanguageNotSupported)
80
- end
81
- end
82
-
83
- describe "normalized_uri" do
84
- it "should remove the trailing file name from any url that ends in index.*" do
85
- index_uri = 'http://example.com/some_dir/'
86
- ['html','aspx','shtm','htm','asp','php','cfm','jsp','shtml','jhtml'].each { |ext|
87
- Entry.normalized_uri(index_uri + 'index.' + ext).should == index_uri
88
- }
89
- end
90
- end
91
-
92
- describe "recommendation requested omitting certain feeds" do
93
- it "should not contain entries from those feeds" do
94
- feed1_id = Factory(:feed).id
95
- feed2_id = Factory(:feed).id
96
- feed1_id.should_not == feed2_id
97
- Recommendation.create(:entry_id => @entry.id, :dest_entry_id => Factory.create(:entry, :feed_id => feed1_id).id)
98
- Recommendation.create(:entry_id => @entry.id, :dest_entry_id => Factory.create(:entry, :feed_id => feed2_id).id)
99
- r = @entry.related_entries.top(false, 5, feed2_id.to_s)
100
- r.length.should == 1
101
- r.each { |e| assert_not_equal feed2_id, e.feed_id}
102
- end
103
- end
104
-
105
- describe "with 3 recommendations" do
106
- before do
107
- 3.times { |n| Recommendation.create(:entry_id => @entry.id,
108
- :dest_entry_id => Factory(:entry).id, :relevance => n.to_f/10.0) }
109
- end
110
-
111
- it "should have 3 related_entries" do
112
- @entry.related_entries.top.length.should == 3
113
- end
114
-
115
- it "should return only 2 if specified" do
116
- @entry.related_entries.top(true,2).length.should == 2
117
- end
118
-
119
- it "should return results in order of relevance by default" do
120
- related_entries = @entry.related_entries.top
121
- related_entries[1].relevance.should < related_entries[0].relevance
122
- related_entries[2].relevance.should < related_entries[1].relevance
123
- end
124
-
125
- end
126
-
127
- describe "recommendation requested without details" do
128
- it "should not have an author" do
129
- Recommendation.create(:entry_id => @entry.id,
130
- :dest_entry_id => Factory.create(:entry, :author => Factory.next(:name)).id,
131
- :relevance => '.3')
132
- lambda{
133
- @entry.related_entries.top.first.author
134
- }.should raise_error
135
- end
136
-
137
- it "should have basic fields" do
138
- title = Factory.next(:name)
139
- collection = Factory.next(:name)
140
- feed_id = Factory(:feed, :short_title => collection).id
141
- dest_entry_id = Factory.create(:entry, :title => title, :feed_id => feed_id).id
142
- relevance = '.3'
143
- recommendation_id = Recommendation.create(:entry_id => @entry.id, :relevance => relevance,
144
- :dest_entry_id => dest_entry_id).id.to_s
145
- r = @entry.related_entries.top(true).first
146
- lambda do
147
- r.recommendation_id.should == recommendation_id
148
- r.relevance.to_f.should == relevance.to_f
149
- r.title.should == title
150
- r.collection.should == collection
151
- r.dest_entry_id.should_not be_nil
152
- end.should_not raise_error
153
- end
154
- end
155
-
156
- describe "recommendation requested with details" do
157
- it "should have basic and detailed fields" do
158
- title = Factory.next(:name)
159
- collection = Factory.next(:name)
160
- author = Factory.next(:name)
161
- published_at = DateTime.now
162
- clicks = 23
163
- average_time_at_dest = 44
164
- description = Factory.next(:name)
165
- permalink = Factory.next(:uri)
166
- direct_uri = Factory.next(:uri)
167
- feed_id = Factory(:feed, :short_title => collection).id
168
- relevance = '.3'
169
- dest_entry_id = Factory.create(:entry, :feed_id => feed_id, :title => title,
170
- :author => author, :published_at => published_at, :permalink => permalink,
171
- :direct_link => direct_uri, :description => description).id
172
- recommendation_id = Recommendation.create(:entry_id => @entry.id, :relevance => relevance,
173
- :avg_time_at_dest => average_time_at_dest, :clicks => clicks, :dest_entry_id => dest_entry_id).id.to_s
174
- r = @entry.related_entries.top(true).first
175
- lambda do
176
- r.recommendation_id.should == recommendation_id
177
- r.relevance.to_f.should == relevance.to_f
178
- r.title.should == title
179
- r.collection.should == collection
180
- r.dest_entry_id.should_not be_nil
181
-
182
- r.author.should == author
183
- # r.published_at.should == published_at
184
- r.clicks.to_i.should == clicks
185
- r.permalink.should == permalink
186
- r.direct_uri.should == direct_uri
187
- r.average_time_at_dest.to_i.should == average_time_at_dest
188
- r.description.should == description
189
- end.should_not raise_error
190
- end
191
- end
192
-
193
- end
194
-
195
- end
@@ -1,22 +0,0 @@
1
- # == Schema Information
2
- #
3
- # Table name: feed_parents
4
- #
5
- # id :integer(4) not null, primary key
6
- # feed_id :integer(4)
7
- # ownable_id :integer(4)
8
- # ownable_type :string(255)
9
- # created_at :datetime
10
- # updated_at :datetime
11
- #
12
-
13
- require File.dirname(__FILE__) + '/../spec_helper'
14
-
15
- describe FeedParent do
16
-
17
- describe "A feed parent instance" do
18
- it { should belong_to :feed }
19
- it { should belong_to :ownable }
20
- end
21
-
22
- end
@@ -1,204 +0,0 @@
1
- # == Schema Information
2
- #
3
- # Table name: feeds
4
- #
5
- # id :integer(4) not null, primary key
6
- # uri :string(2083)
7
- # display_uri :string(2083)
8
- # title :string(1000)
9
- # short_title :string(100)
10
- # description :text
11
- # tag_filter :string(1000)
12
- # top_tags :text
13
- # priority :integer(4) default(10)
14
- # status :integer(4) default(1)
15
- # last_requested_at :datetime default(Wed Jan 01 00:00:00 UTC 1969)
16
- # last_harvested_at :datetime default(Wed Jan 01 00:00:00 UTC 1969)
17
- # harvest_interval :integer(4) default(86400)
18
- # failed_requests :integer(4) default(0)
19
- # error_message :text
20
- # service_id :integer(4) default(0)
21
- # login :string(255)
22
- # password :string(255)
23
- # created_at :datetime
24
- # updated_at :datetime
25
- # entries_changed_at :datetime
26
- # harvested_from_display_uri :string(2083)
27
- # harvested_from_title :string(1000)
28
- # harvested_from_short_title :string(100)
29
- # entries_count :integer(4)
30
- # default_language_id :integer(4) default(0)
31
- # default_grain_size :string(255) default("unknown")
32
- # contributor_id :integer(4)
33
- # etag :string(255)
34
- #
35
-
36
- require File.dirname(__FILE__) + '/../spec_helper'
37
-
38
- # Used to test muck_content_permission
39
- describe Feed do
40
-
41
- describe "A feed instance" do
42
- before do
43
- @feed = Factory(:feed)
44
- end
45
-
46
- it { should have_many :feed_parents }
47
- it { should have_many :entries }
48
- it { should belong_to :contributor }
49
- it { should belong_to :default_language }
50
- it { should belong_to :service }
51
-
52
- it { should validate_presence_of :uri }
53
- it { should validate_uniqueness_of :uri }
54
-
55
- it { should scope_by_title }
56
- it { should scope_newer_than }
57
- it { should scope_by_newest }
58
-
59
- it "should set 24 hours as default interval" do
60
- @feed.harvest_interval_hours.should == 24
61
- end
62
-
63
- it "should set harvest interval by hours" do
64
- @feed.harvest_interval_hours = 10
65
- @feed.harvest_interval.should == 10 * 3600
66
- end
67
-
68
- describe "named scope" do
69
- describe "banned" do
70
- before do
71
- @feed = Factory(:feed, :status => MuckServices::Status::BANNED)
72
- @feed_not = Factory(:feed)
73
- end
74
- it "should find feeds that are banned" do
75
- Feed.banned.should include(@feed)
76
- end
77
- it "should not find feeds that are not banned" do
78
- Feed.banned.should_not include(@feed_not)
79
- end
80
- end
81
- describe "valid" do
82
- before do
83
- @feed = Factory(:feed, :status => 0)
84
- @feed_not = Factory(:feed, :status => MuckServices::Status::BANNED)
85
- end
86
- it "should find valid feeds" do
87
- Feed.valid.should include(@feed)
88
- end
89
- it "should not find invalid feeds" do
90
- Feed.valid.should_not include(@feed_not)
91
- end
92
- end
93
- end
94
-
95
- end
96
-
97
- describe "Feed status" do
98
- before do
99
- @feed = Factory(:feed)
100
- end
101
- it "should be banned" do
102
- @feed.status = MuckServices::Status::BANNED
103
- @feed.banned?.should be_true
104
- end
105
- it "should be approved" do
106
- @feed.status = MuckServices::Status::APPROVED
107
- @feed.banned?.should be_false
108
- end
109
- it "should be pending" do
110
- @feed.status = MuckServices::Status::PENDING
111
- @feed.pending?.should be_true
112
- end
113
- end
114
-
115
- describe "Get feed information" do
116
- it "shouldGet feed information" do
117
- Feed.gather_information(TEST_URI)
118
- end
119
- it "shouldDiscover feeds from url" do
120
- Feed.discover_feeds(TEST_URI)
121
- end
122
- it "shouldDiscover feeds from xml url" do
123
- Feed.discover_feeds(TEST_XML_URI)[0].url.should == TEST_XML_URI
124
- end
125
- end
126
-
127
- describe "Harvest feed" do
128
- before do
129
- @feed = Factory(:feed, :uri => TEST_RSS_URI, :display_uri => TEST_URI)
130
- end
131
- it "should get new entries" do
132
- entries = @feed.harvest
133
- entries.length.should > 0
134
- end
135
- end
136
-
137
- describe "Delete feed if unused" do
138
- before do
139
- @user = Factory(:user)
140
- @identity_user = Factory(:user)
141
- @delete_feed = Factory(:feed, :contributor => @user)
142
- @dont_delete_feed = Factory(:feed, :contributor => @user)
143
- @identity_user.own_feeds << @dont_delete_feed
144
- end
145
- it "should delete feed" do
146
- @delete_feed.delete_if_unused(@user).should be_true
147
- end
148
- it "should not delete feed" do
149
- @dont_delete_feed.delete_if_unused(@user).should be_false
150
- end
151
- end
152
-
153
- describe "global feed and references" do
154
- before do
155
- @global_feed = Factory(:feed)
156
- @user = Factory(:user)
157
- @feed = Factory(:feed)
158
- @user.feeds << @feed
159
- @feed.reload
160
- @identity_feed = Factory(:feed)
161
- @user.own_feeds << @identity_feed
162
- @identity_feed.reload
163
- @aggregation_feed = Factory(:feed)
164
- @aggregation = Factory(:aggregation, :ownable => @user)
165
- @aggregation.feeds << @aggregation_feed
166
- end
167
-
168
- describe "referenced feed" do
169
- describe "feed" do
170
- it "should be non-global" do
171
- @feed.global?.should be_false
172
- end
173
- it "should be in use" do
174
- @feed.in_use?.should be_true
175
- end
176
- end
177
- describe "identity feed" do
178
- it "should be non-global" do
179
- @identity_feed.global?.should be_false
180
- end
181
- it "should be in use" do
182
- @identity_feed.in_use?.should be_true
183
- end
184
- end
185
- describe "aggregation feed" do
186
- it "should be non-global" do
187
- @aggregation_feed.global?.should be_false
188
- end
189
- it "should be in use" do
190
- @aggregation_feed.in_use?.should be_true
191
- end
192
- end
193
- end
194
- describe "global feed" do
195
- it "should be a global feed" do
196
- @global_feed.global?.should be_true
197
- end
198
- it "should not be in use" do
199
- @global_feed.in_use?.should be_false
200
- end
201
- end
202
- end
203
-
204
- end
@@ -1,18 +0,0 @@
1
- # == Schema Information
2
- #
3
- # Table name: identity_feeds
4
- #
5
- # id :integer(4) not null, primary key
6
- # feed_id :integer(4) not null
7
- # ownable_id :integer(4) not null
8
- # ownable_type :string(255) not null
9
- #
10
-
11
- require File.dirname(__FILE__) + '/../spec_helper'
12
-
13
- describe IdentityFeed do
14
- describe "identity feed" do
15
- it { should belong_to :ownable }
16
- it { should belong_to :feed }
17
- end
18
- end
@@ -1,78 +0,0 @@
1
- # == Schema Information
2
- #
3
- # Table name: oai_endpoints
4
- #
5
- # id :integer(4) not null, primary key
6
- # uri :string(2083)
7
- # display_uri :string(2083)
8
- # metadata_prefix :string(255)
9
- # title :string(1000)
10
- # short_title :string(100)
11
- # contributor_id :integer(4)
12
- # status :integer(4)
13
- # default_language_id :integer(4)
14
- # created_at :datetime
15
- # updated_at :datetime
16
- #
17
-
18
- require File.dirname(__FILE__) + '/../spec_helper'
19
-
20
- # Used to test muck_content_permission
21
- describe OaiEndpoint do
22
-
23
- describe "An oai endpoint instance" do
24
- before do
25
- @oai_endpoint = Factory(:oai_endpoint)
26
- end
27
-
28
- it { should belong_to :contributor }
29
- it { should belong_to :default_language }
30
- it { should validate_presence_of :uri }
31
- it { should scope_by_title }
32
- it { should scope_newer_than }
33
- it { should scope_by_newest }
34
-
35
- describe "named scope" do
36
- describe "banned" do
37
- before do
38
- @oai_endpoint = Factory(:oai_endpoint, :status => MuckServices::Status::BANNED)
39
- @oai_endpoint_not = Factory(:oai_endpoint)
40
- end
41
- it "should find oai_endpoints that are banned" do
42
- OaiEndpoint.banned.should include(@oai_endpoint)
43
- end
44
- it "should not find oai_endpoints that are not banned" do
45
- OaiEndpoint.banned.should_not include(@oai_endpoint_not)
46
- end
47
- end
48
- describe "valid" do
49
- before do
50
- @oai_endpoint = Factory(:oai_endpoint, :status => 0)
51
- @oai_endpoint_not = Factory(:oai_endpoint, :status => MuckServices::Status::BANNED)
52
- end
53
- it "should find valid oai_endpoints" do
54
- OaiEndpoint.valid.should include(@oai_endpoint)
55
- end
56
- it "should not find invalid oai_endpoints" do
57
- OaiEndpoint.valid.should_not include(@oai_endpoint_not)
58
- end
59
- end
60
- end
61
-
62
- end
63
-
64
- describe "banned/unbanned" do
65
- before do
66
- @oai_endpoint = Factory(:oai_endpoint)
67
- end
68
- it "should be banned" do
69
- @oai_endpoint.status = -1
70
- @oai_endpoint.banned?.should be_true
71
- end
72
- it "should not be banned" do
73
- @oai_endpoint.status = 0
74
- @oai_endpoint.banned?.should be_false
75
- end
76
- end
77
-
78
- end