forked from publify/publify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration_spec.rb
385 lines (298 loc) · 10.6 KB
/
configuration_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
require 'spec_helper'
describe 'Given a new blog' do
before(:each) do
@blog = Blog.new
end
it '#blog_name should be My Shiny Weblog!' do
@blog.blog_name.should == 'My Shiny Weblog!'
end
it '#blog_subtitle should be ""' do
@blog.blog_subtitle.should == ''
end
it '#geourl_location should be ""' do
@blog.geourl_location.should == ''
end
it '#canonical_server_url should be ""' do
@blog.geourl_location.should == ''
end
it '#lang should be en_US' do
@blog.lang.should == 'en_US'
end
# Must find a better name for this key!
it 'Global spam protection is not enabled' do
@blog.should_not be_sp_global
end
it "#sp_article_auto_close should be 0" do
@blog.sp_article_auto_close.should == 0
end
it "#sp_url_limit should be 0" do
@blog.sp_url_limit.should == 0
end
it "#sp_akismet_key should be blank" do
@blog.sp_akismet_key.should == ''
end
it "#use_recaptcha should be false" do
@blog.should_not be_use_recaptcha
end
it '#text_filter and #comment_text_filter should be markdown smartypants' do
@blog.text_filter.should == 'markdown smartypants'
@blog.comment_text_filter.should == 'markdown smartypants'
end
it '#limit_article_display and #limit_rss_display should be 10' do
@blog.limit_article_display.should == 10
@blog.limit_rss_display.should == 10
end
it 'Pings should not be allowed by default' do
@blog.should_not be_default_allow_pings
end
it 'Comments should be allowed unmoderated by default' do
@blog.should be_default_allow_comments
@blog.should_not be_default_moderate_comments
end
it 'Should not link to author' do
@blog.should_not be_link_to_author
end
it 'Should not hide extended on rss' do
@blog.should_not be_hide_extended_on_rss
end
it '#theme should be "Bootstrap"' do
@blog.theme.should == 'bootstrap'
end
it 'should not use any avatar plugin' do
@blog.plugin_avatar.should == ''
end
# Another clumsy setting name
it '#global_pings_disable should be false' do
@blog.global_pings_disable.should == false
@blog.should_not be_global_pings_disable
end
it 'should ping technorati, blog.gs and weblogs.com' do
@blog.ping_urls.should == "http://blogsearch.google.com/ping/RPC2\nhttp://rpc.technorati.com/rpc/ping\nhttp://ping.blo.gs/\nhttp://rpc.weblogs.com/RPC2"
end
it 'should send outbound pings' do
@blog.should be_send_outbound_pings
end
it '#email_from should be publify@example.com' do
@blog.email_from.should == 'publify@example.com'
end
it '#date format should be day/month/year hour:minute' do
@blog.date_format.should == '%d/%m/%Y'
@blog.time_format.should == '%Hh%M'
end
it 'Thumb, medium and avatar image size' do
@blog.image_avatar_size.should == 48
@blog.image_thumb_size.should == 125
@blog.image_medium_size.should == 600
end
it 'Default meta keyword and description should be empty' do
@blog.meta_description.should == ''
@blog.meta_keywords.should == ''
end
it 'Google analytics and Webmaster toold should be empty' do
@blog.google_verification.should == ''
@blog.google_analytics.should == ''
end
it '#feedburner should be empty' do
@blog.feedburner_url.should == ''
end
it 'RSS description should be disable but not empty' do
@blog.should_not be_rss_description
@blog.rss_description_text.should == "<hr /><p><small>Original article writen by %author% and published on <a href='%blog_url%'>%blog_name%</a> | <a href='%permalink_url%'>direct link to this article</a> | If you are reading this article elsewhere than <a href='%blog_url%'>%blog_name%</a>, it has been illegally reproduced and without proper authorization.</small></p>"
end
it 'Permalink format should be /year/month/day/title' do
@blog.permalink_format.should == '/%year%/%month%/%day%/%title%'
end
# really?!
it 'Robots.txt should be empty' do
@blog.robots.should == ''
end
it 'Categories and tags should be indexed' do
@blog.should be_index_categories
@blog.should_not be_unindex_categories
@blog.should be_index_tags
@blog.should_not be_unindex_tags
end
it 'Displays 10 elements in admin' do
@blog.admin_display_elements.should == 10
end
it 'Links are nofollow by default' do
@blog.should be_nofollowify
@blog.should_not be_dofollowify
end
it 'Use of canonical URL is disabled by default' do
@blog.should_not be_use_canonical_url
end
it 'Use of meta keywords is enabled by default' do
@blog.should be_use_meta_keyword
end
it '#is_okay should be false until #blog_name is explicitly set' do
@blog.should_not be_configured
@blog.blog_name = 'Specific blog name'
@blog.should be_configured
end
it 'home display template is blog name | blog description | meta keywords' do
@blog.home_title_template.should == "%blog_name% | %blog_subtitle%"
@blog.home_desc_template.should == "%blog_name% | %blog_subtitle% | %meta_keywords%"
end
it 'article template is title | blog name with excerpt in the description' do
@blog.article_title_template.should == "%title% | %blog_name%"
@blog.article_desc_template.should == "%excerpt%"
end
it 'page template is title | blog name with excerpt in the description' do
@blog.page_title_template.should == "%title% | %blog_name%"
@blog.page_desc_template.should == "%excerpt%"
end
it 'paginated template is title | blog name | page with keywords in the description' do
@blog.paginated_title_template.should == "%blog_name% | %blog_subtitle% %page%"
@blog.paginated_desc_template.should == "%blog_name% | %blog_subtitle% | %meta_keywords% %page%"
end
it 'category title template is Category: name | blog_name | page' do
@blog.category_title_template.should == "Category: %name% | %blog_name% %page%"
end
it 'category description template is name | description | blog description page' do
@blog.category_desc_template.should == "%name% | %description% | %blog_subtitle% %page%"
end
it 'tags title template is Tag: name | blog_name | page' do
@blog.tag_title_template.should == "Tag: %name% | %blog_name% %page%"
end
it 'tags description template is name | description | blog description page' do
@blog.tag_desc_template.should == "%name% | %blog_name% | %blog_subtitle% %page%"
end
it 'author title template is name | blog_name' do
@blog.author_title_template.should == "%author% | %blog_name%"
end
it 'author description template is name | blog name | blog description page' do
@blog.author_desc_template.should == "%author% | %blog_name% | %blog_subtitle%"
end
it 'archives title template is Archives for blog name date page' do
@blog.archives_title_template.should == "Archives for %blog_name% %date% %page%"
end
it 'archives description template is Archives for blog name date page blog description' do
@blog.archives_desc_template.should == "Archives for %blog_name% %date% %page% %blog_subtitle%"
end
it 'search title template is Archives for blog name date page' do
@blog.search_title_template.should == "Results for %search% | %blog_name% %page%"
end
it 'search description template is Archives for blog name date page blog description' do
@blog.search_desc_template.should == "Results for %search% | %blog_name% | %blog_subtitle% %page%"
end
it 'status list title is Statuses | blog name page' do
@blog.statuses_title_template.should == "Notes | %blog_name% %page%"
end
it 'status list description is Notes | blog name | blog subtitle page' do
@blog.statuses_desc_template.should == "Notes | %blog_name% | %blog_subtitle% %page%"
end
it 'a single status title is status content | blog name' do
@blog.status_title_template.should == "%body% | %blog_name%"
end
it 'status list description is status content' do
@blog.status_desc_template.should == "%excerpt%"
end
it 'custom tracking fiels is empty' do
@blog.custom_tracking_field.should == ''
end
it 'twitter_consumer_key is empty' do
@blog.twitter_consumer_key.should == ''
end
it 'twitter consumer secret should be empty' do
@blog.twitter_consumer_secret.should == ''
end
it 'should have an empty custom url shortener' do
@blog.custom_url_shortener.should == ''
end
it 'a new blog should display statuses in the main feed' do
@blog.statuses_in_timeline.should == true
end
end
describe 'Given a new user' do
before(:each) do
@user = User.new
end
it 'New comments on self articles should be notified' do
@user.should be_notify_watch_my_articles
end
it 'Firstname is empty' do
@user.firstname.should == ''
end
it 'Lastname is empty' do
@user.lastname.should == ''
end
it 'Nickname is empty' do
@user.nickname.should == ''
end
it 'Description is empty' do
@user.description.should == ''
end
it 'URL is empty' do
@user.url.should == ''
end
it 'MSN is empty' do
@user.msn.should == ''
end
it 'aim is empty' do
@user.aim.should == ''
end
it 'Yahoo ID is empty' do
@user.yahoo.should == ''
end
it 'Twitter is empty' do
@user.description.should == ''
end
it 'Jabber is empty' do
@user.jabber.should == ''
end
it 'Admin theme should be blue' do
@user.admin_theme.should == 'blue'
end
it 'Twitter account for statuses should be empty' do
@user.twitter_account.should == ''
end
it 'Twitter oauth token should be empty' do
@user.twitter_oauth_token.should == ''
end
it 'Twitter oauth secret token should be empty' do
@user.twitter_oauth_token_secret.should == ''
end
it 'Twitter profile image should be empty' do
@user.twitter_profile_image.should == ''
end
it 'avatar is empty' do
@user.avatar.should == ''
@user.thumb_avatar.should == ''
@user.medium_avatar.should == ''
@user.large_avatar.should == ''
end
end
describe 'Given a new article' do
before(:each) do
@article = Article.new
end
it 'A new article should get an empty password' do
@article.password.should == ''
end
end
describe 'Given a new page' do
before(:each) do
@page = Page.new
end
it 'A new page should get an empty password' do
@page.password.should == ''
end
end
describe "Given a new status" do
before(:each) do
@note = Note.new
end
it "should not have a twitter id set" do
@note.twitter_id.should == ""
end
it "should not reply to another one" do
@note.in_reply_to_status_id.should == ""
end
it "should not have a reply context message" do
@note.in_reply_to_message.should == ""
end
it "should not have a reply context protected" do
@note.in_reply_to_protected.should == false
end
end