tdiary 4.0.2.20140201 → 4.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/ChangeLog +3 -0
- data/Gemfile +5 -5
- data/Gemfile.lock +48 -29
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/index.rb +2 -2
- data/js/01conf.js +16 -0
- data/misc/convert2.rb +3 -3
- data/misc/filter/limitdays.rb +2 -2
- data/misc/filter/linkcheck.rb +2 -2
- data/misc/lib/fcgi_patch.rb +3 -3
- data/misc/paas/cloudfoundry/Gemfile.lock +51 -48
- data/misc/paas/heroku/Gemfile.lock +23 -21
- data/misc/paas/sqale/Gemfile.lock +23 -21
- data/misc/plugin/a.rb +4 -4
- data/misc/plugin/calendar2.rb +1 -1
- data/misc/plugin/category.rb +3 -3
- data/misc/plugin/comment_emoji_autocomplete.rb +1 -1
- data/misc/plugin/comment_mail-qmail.rb +1 -1
- data/misc/plugin/comment_mail-sendmail.rb +1 -1
- data/misc/plugin/comment_mail-smtp.rb +1 -1
- data/misc/plugin/counter.rb +27 -27
- data/misc/plugin/disp_referrer.rb +1 -1
- data/misc/plugin/en/amazon.rb +2 -2
- data/misc/plugin/en/category.rb +1 -1
- data/misc/plugin/en/counter.rb +1 -1
- data/misc/plugin/en/disp_referrer.rb +1 -1
- data/misc/plugin/en/kw.rb +1 -1
- data/misc/plugin/en/search_form.rb +1 -1
- data/misc/plugin/en/todo.rb +1 -1
- data/misc/plugin/en/weather.rb +5 -2
- data/misc/plugin/image.rb +2 -2
- data/misc/plugin/ja/disp_referrer.rb +7 -7
- data/misc/plugin/ja/my-sequel.rb +1 -1
- data/misc/plugin/ja/recent_comment3.rb +1 -1
- data/misc/plugin/ja/referer_scheme.rb +1 -1
- data/misc/plugin/ja/search_control.rb +1 -1
- data/misc/plugin/ja/search_form.rb +2 -2
- data/misc/plugin/ja/todo.rb +1 -1
- data/misc/plugin/ja/weather.rb +17 -12
- data/misc/plugin/makelirs.rb +4 -4
- data/misc/plugin/my-ex.rb +1 -1
- data/misc/plugin/my-sequel.rb +1 -1
- data/misc/plugin/pb-show.rb +1 -1
- data/misc/plugin/recent_comment.rb +5 -5
- data/misc/plugin/recent_comment3.rb +2 -2
- data/misc/plugin/recent_namazu.rb +4 -4
- data/misc/plugin/recent_rss.rb +7 -7
- data/misc/plugin/referer_scheme.rb +2 -2
- data/misc/plugin/search-default.rb +1 -1
- data/misc/plugin/sn.rb +3 -3
- data/misc/plugin/speed_comment.rb +1 -1
- data/misc/plugin/squeeze.rb +8 -8
- data/misc/plugin/tb-show.rb +1 -1
- data/misc/plugin/theme_online.rb +25 -0
- data/misc/plugin/tlink.rb +2 -2
- data/misc/plugin/todo.rb +2 -2
- data/misc/plugin/weather.rb +82 -26
- data/misc/plugin/whatsnew.rb +1 -1
- data/misc/plugin/xmlrpc/xmlrpc.rb +11 -11
- data/misc/theme_convert/theme_convert.rb +3 -3
- data/plugin/00default.rb +35 -28
- data/plugin/50sp.rb +1 -1
- data/plugin/60sf.rb +1 -1
- data/plugin/90migrate.rb +2 -2
- data/plugin/en/00default.rb +1 -1
- data/plugin/ja/00default.rb +1 -1
- data/spec/acceptance/append_comment_spec.rb +18 -18
- data/spec/acceptance/append_diary_spec.rb +22 -22
- data/spec/acceptance/bugfix/encoding_error_spec.rb +1 -1
- data/spec/acceptance/save_conf_comment_spec.rb +15 -15
- data/spec/acceptance/save_conf_default_spec.rb +26 -26
- data/spec/acceptance/save_conf_dnsbl_spec.rb +19 -19
- data/spec/acceptance/save_conf_filter_spec.rb +6 -6
- data/spec/acceptance/save_conf_plugin_spec.rb +11 -11
- data/spec/acceptance/save_conf_referer_spec.rb +4 -4
- data/spec/acceptance/save_conf_security_spec.rb +28 -28
- data/spec/acceptance/update_diary_spec.rb +16 -16
- data/spec/acceptance/view_category_spec.rb +1 -1
- data/spec/acceptance/view_comment_spec.rb +6 -6
- data/spec/acceptance/view_diary_spec.rb +25 -25
- data/spec/acceptance/view_referer_spec.rb +3 -3
- data/spec/core/compatible_spec.rb +5 -5
- data/spec/core/configuration_spec.rb +3 -3
- data/spec/core/core_ext_spec.rb +7 -7
- data/spec/core/io/default_spec.rb +1 -1
- data/spec/core/plugin_spec.rb +41 -41
- data/spec/core/rack/assets/precompile_spec.rb +3 -3
- data/spec/core/rack/html_anchor_spec.rb +15 -15
- data/spec/core/rack/static_spec.rb +3 -3
- data/spec/core/rack/valid_request_path_spec.rb +13 -13
- data/spec/core/style/tdiary_style_spec.rb +10 -10
- data/spec/core/style/wiki_style_spec.rb +16 -16
- data/spec/plugin/bq_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -1
- data/tdiary/configuration.rb +2 -2
- data/tdiary/environment.rb +1 -1
- data/tdiary/io/default.rb +1 -1
- data/tdiary/lang/ja.rb +2 -2
- data/tdiary/tasks/db.rake +5 -5
- data/tdiary/version.rb +1 -1
- data/test/disp_referrer_test.rb +4 -4
- data/test/my-sequel_test.rb +1 -1
- data/test/test_plugin_helper.rb +47 -0
- data/test/weather-ADDS-METARS-PHTO-140131.html +109 -0
- data/test/weather-ADDS-METARS-RJAA-130131.html +111 -0
- data/test/weather-ADDS-METARS-RJAA-130227.html +111 -0
- data/test/weather_test.rb +144 -18
- data/update.rb +2 -2
- metadata +10 -3
data/spec/core/plugin_spec.rb
CHANGED
@@ -16,13 +16,13 @@ describe TDiary::Plugin do
|
|
16
16
|
subject { @plugin }
|
17
17
|
|
18
18
|
it '読み込まれたプラグインのメソッドを呼び出せること' do
|
19
|
-
subject.sample.
|
19
|
+
expect(subject.sample).to eq 'sample plugin'
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'プラグイン一覧が @plugin_files で取得できること' do
|
23
23
|
# TODO: 実際にはPlugin.newした時点でload_pluginが呼ばれている
|
24
24
|
# @plugin_filesの追加もinitializeメソッド内で実行されている
|
25
|
-
subject.instance_variable_get(:@plugin_files).
|
25
|
+
expect(subject.instance_variable_get(:@plugin_files)).to include('spec/fixtures/plugin/sample.rb')
|
26
26
|
end
|
27
27
|
|
28
28
|
context 'リソースファイルが存在する場合' do
|
@@ -32,7 +32,7 @@ describe TDiary::Plugin do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'Confファイルで指定した言語に対応するリソースが読み込まれること' do
|
35
|
-
@plugin.sample_ja.
|
35
|
+
expect(@plugin.sample_ja).to eq 'サンプルプラグイン'
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -45,12 +45,12 @@ describe TDiary::Plugin do
|
|
45
45
|
subject { @plugin.eval_src(@src, false) }
|
46
46
|
|
47
47
|
it 'Pluginオブジェクト内でソースが実行されること' do
|
48
|
-
|
48
|
+
is_expected.to eq 'hello sample plugin'
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'secureモード指定の場合' do
|
52
52
|
it 'Safeモード4で実行されること' do
|
53
|
-
Safe.
|
53
|
+
expect(Safe).to receive(:safe).with(4)
|
54
54
|
@plugin.eval_src(@src, true)
|
55
55
|
end
|
56
56
|
end
|
@@ -72,7 +72,7 @@ describe TDiary::Plugin do
|
|
72
72
|
subject { @plugin.__send__(:header_proc) }
|
73
73
|
|
74
74
|
it 'add_header_procで登録したブロックが実行されること' do
|
75
|
-
|
75
|
+
is_expected.to eq 'header1 header2'
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -84,7 +84,7 @@ describe TDiary::Plugin do
|
|
84
84
|
subject { @plugin.__send__(:footer_proc) }
|
85
85
|
|
86
86
|
it 'add_footer_procで登録したブロックが実行されること' do
|
87
|
-
|
87
|
+
is_expected.to eq 'footer1 footer2'
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -98,14 +98,14 @@ describe TDiary::Plugin do
|
|
98
98
|
subject { @plugin.__send__(:update_proc) }
|
99
99
|
|
100
100
|
it 'add_update_procで登録したブロックが実行されること' do
|
101
|
-
proc1.
|
102
|
-
proc2.
|
101
|
+
expect(proc1).to receive(:call)
|
102
|
+
expect(proc2).to receive(:call)
|
103
103
|
# should_receiveの場合はsubjectが使えないため明示的に実行
|
104
104
|
@plugin.__send__(:update_proc)
|
105
105
|
end
|
106
106
|
|
107
107
|
it '空の文字列を返すこと' do
|
108
|
-
|
108
|
+
is_expected.to eq ''
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -120,17 +120,17 @@ describe TDiary::Plugin do
|
|
120
120
|
subject { @plugin.__send__(:title_proc, date, 'title') }
|
121
121
|
|
122
122
|
it 'add_title_procで登録したブロックを実行し、最後の結果を返すこと' do
|
123
|
-
|
123
|
+
is_expected.to eq 'title2'
|
124
124
|
end
|
125
125
|
|
126
126
|
it '前のprocの結果が次のprocに渡されること' do
|
127
|
-
proc1.
|
128
|
-
proc2.
|
127
|
+
expect(proc1).to receive(:call).with(date, 'title').and_return('title1')
|
128
|
+
expect(proc2).to receive(:call).with(date, 'title1')
|
129
129
|
@plugin.__send__(:title_proc, date, 'title')
|
130
130
|
end
|
131
131
|
|
132
132
|
it 'apply_pluginメソッドを呼び出すこと' do
|
133
|
-
@plugin.
|
133
|
+
expect(@plugin).to receive(:apply_plugin)
|
134
134
|
# should_receiveの場合はsubjectが使えないため明示的に実行
|
135
135
|
@plugin.__send__(:title_proc, date, 'title')
|
136
136
|
end
|
@@ -145,7 +145,7 @@ describe TDiary::Plugin do
|
|
145
145
|
subject { @plugin.__send__(:body_enter_proc, date) }
|
146
146
|
|
147
147
|
it 'add_body_enter_procで登録したブロックが実行されること' do
|
148
|
-
|
148
|
+
is_expected.to eq 'body1 body2'
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
@@ -157,7 +157,7 @@ describe TDiary::Plugin do
|
|
157
157
|
subject { @plugin.__send__(:body_leave_proc, @date) }
|
158
158
|
|
159
159
|
it 'add_body_leave_procで登録したブロックが実行されること' do
|
160
|
-
|
160
|
+
is_expected.to eq 'body1 body2'
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
@@ -173,15 +173,15 @@ describe TDiary::Plugin do
|
|
173
173
|
subject { @plugin.__send__(:section_enter_proc, date1) }
|
174
174
|
|
175
175
|
it 'add_section_enter_procで登録したブロックを実行し、結果を連結して返すこと' do
|
176
|
-
|
176
|
+
is_expected.to eq 'section1 section2'
|
177
177
|
end
|
178
178
|
|
179
179
|
it '呼ばれた回数に応じてセクション番号の数が増加すること (日付単位)' do
|
180
|
-
proc1.
|
180
|
+
expect(proc1).to receive(:call).with(date1, 1)
|
181
181
|
@plugin.__send__(:section_enter_proc, date1)
|
182
|
-
proc1.
|
182
|
+
expect(proc1).to receive(:call).with(date1, 2)
|
183
183
|
@plugin.__send__(:section_enter_proc, date1)
|
184
|
-
proc1.
|
184
|
+
expect(proc1).to receive(:call).with(date2, 1)
|
185
185
|
@plugin.__send__(:section_enter_proc, date2)
|
186
186
|
end
|
187
187
|
end
|
@@ -198,18 +198,18 @@ describe TDiary::Plugin do
|
|
198
198
|
subject { @plugin.__send__(:subtitle_proc, date1, 'subtitle') }
|
199
199
|
|
200
200
|
it 'add_subtitle_procで登録したブロックを実行し、最後の結果を返すこと' do
|
201
|
-
|
201
|
+
is_expected.to eq 'subtitle2'
|
202
202
|
end
|
203
203
|
|
204
204
|
it '前のprocの結果が次のprocに渡されること' do
|
205
|
-
proc1.
|
206
|
-
proc2.
|
205
|
+
expect(proc1).to receive(:call).with(date1, 1, 'subtitle').and_return('subtitle1')
|
206
|
+
expect(proc2).to receive(:call).with(date1, 1, 'subtitle1')
|
207
207
|
@plugin.__send__(:section_enter_proc, date1)
|
208
208
|
@plugin.__send__(:subtitle_proc, date1, 'subtitle')
|
209
209
|
end
|
210
210
|
|
211
211
|
it 'apply_pluginメソッドを呼び出すこと' do
|
212
|
-
@plugin.
|
212
|
+
expect(@plugin).to receive(:apply_plugin)
|
213
213
|
# should_receiveの場合はsubjectが使えないため明示的に実行
|
214
214
|
@plugin.__send__(:subtitle_proc, date1, 'title')
|
215
215
|
end
|
@@ -227,18 +227,18 @@ describe TDiary::Plugin do
|
|
227
227
|
subject { @plugin.__send__(:section_leave_proc, date1) }
|
228
228
|
|
229
229
|
it 'add_section_leave_procで登録したブロックを実行し、結果を連結して返すこと' do
|
230
|
-
|
230
|
+
is_expected.to eq 'section1 section2'
|
231
231
|
end
|
232
232
|
|
233
233
|
it '呼ばれた回数に応じてセクション番号の数が増加すること (日付単位)' do
|
234
234
|
# セクション番号はsection_enter_procの呼び出し回数で決定する
|
235
|
-
proc1.
|
235
|
+
expect(proc1).to receive(:call).with(date1, 1)
|
236
236
|
@plugin.__send__(:section_enter_proc, date1)
|
237
237
|
@plugin.__send__(:section_leave_proc, date1)
|
238
|
-
proc1.
|
238
|
+
expect(proc1).to receive(:call).with(date1, 2)
|
239
239
|
@plugin.__send__(:section_enter_proc, date1)
|
240
240
|
@plugin.__send__(:section_leave_proc, date1)
|
241
|
-
proc1.
|
241
|
+
expect(proc1).to receive(:call).with(date2, 1)
|
242
242
|
@plugin.__send__(:section_enter_proc, date2)
|
243
243
|
@plugin.__send__(:section_leave_proc, date2)
|
244
244
|
end
|
@@ -253,7 +253,7 @@ describe TDiary::Plugin do
|
|
253
253
|
subject { @plugin.__send__(:comment_leave_proc, date) }
|
254
254
|
|
255
255
|
it 'add_comment_leave_procで登録したブロックが実行されること' do
|
256
|
-
|
256
|
+
is_expected.to eq 'comment1 comment2'
|
257
257
|
end
|
258
258
|
end
|
259
259
|
|
@@ -266,7 +266,7 @@ describe TDiary::Plugin do
|
|
266
266
|
subject { @plugin.__send__(:edit_proc, date) }
|
267
267
|
|
268
268
|
it 'add_edit_procで登録したブロックが実行されること' do
|
269
|
-
|
269
|
+
is_expected.to eq 'edit1 edit2'
|
270
270
|
end
|
271
271
|
end
|
272
272
|
|
@@ -279,7 +279,7 @@ describe TDiary::Plugin do
|
|
279
279
|
subject { @plugin.__send__(:form_proc, date) }
|
280
280
|
|
281
281
|
it 'add_form_procで登録したブロックが実行されること' do
|
282
|
-
|
282
|
+
is_expected.to eq 'form1 form2'
|
283
283
|
end
|
284
284
|
end
|
285
285
|
|
@@ -290,21 +290,21 @@ describe TDiary::Plugin do
|
|
290
290
|
context '@modeがconfの場合' do
|
291
291
|
before { @plugin.instance_variable_set(:@mode, 'conf') }
|
292
292
|
it 'コールバックを登録すること' do
|
293
|
-
|
293
|
+
is_expected.to include('label1')
|
294
294
|
end
|
295
295
|
end
|
296
296
|
|
297
297
|
context '@modeがsaveconfの場合' do
|
298
298
|
before { @plugin.instance_variable_set(:@mode, 'saveconf') }
|
299
299
|
it 'コールバックを登録すること' do
|
300
|
-
|
300
|
+
is_expected.to include('label1')
|
301
301
|
end
|
302
302
|
end
|
303
303
|
|
304
304
|
context '@modeがconf, saveconf以外の場合' do
|
305
305
|
before { @plugin.instance_variable_set(:@mode, 'edit') }
|
306
306
|
it 'コールバックの登録を無視すること' do
|
307
|
-
|
307
|
+
is_expected.to be_nil
|
308
308
|
end
|
309
309
|
end
|
310
310
|
end
|
@@ -319,7 +319,7 @@ describe TDiary::Plugin do
|
|
319
319
|
subject { @plugin.__send__(:conf_proc, 'key1') }
|
320
320
|
|
321
321
|
it 'add_conf_procで登録したブロックのうち、keyが一致するものを実行して結果を返すこと' do
|
322
|
-
|
322
|
+
is_expected.to eq 'conf1'
|
323
323
|
end
|
324
324
|
end
|
325
325
|
|
@@ -328,7 +328,7 @@ describe TDiary::Plugin do
|
|
328
328
|
subject { @plugin.__send__(:remove_tag, @string) }
|
329
329
|
|
330
330
|
it '文字列からタグが除去されること' do
|
331
|
-
|
331
|
+
is_expected.to eq 'test example.com'
|
332
332
|
end
|
333
333
|
end
|
334
334
|
|
@@ -339,22 +339,22 @@ describe TDiary::Plugin do
|
|
339
339
|
|
340
340
|
subject { @plugin.__send__(:apply_plugin, '<%= sample %>') }
|
341
341
|
it 'プラグインが再実行されること' do
|
342
|
-
|
342
|
+
is_expected.to eq 'sample plugin'
|
343
343
|
end
|
344
344
|
|
345
345
|
context '解釈できない文字列を渡された場合' do
|
346
346
|
subject { @plugin.__send__(:apply_plugin, '<%= undefined_method %>') }
|
347
|
-
it {
|
347
|
+
it { is_expected.to include 'Invalid Text' }
|
348
348
|
end
|
349
349
|
|
350
350
|
context '文字列がnilの場合' do
|
351
351
|
subject { @plugin.__send__(:apply_plugin, nil) }
|
352
|
-
it {
|
352
|
+
it { is_expected.to eq '' }
|
353
353
|
end
|
354
354
|
|
355
355
|
context 'remove_tagがtrueの場合' do
|
356
356
|
it 'remove_tagメソッドを呼び出すこと' do
|
357
|
-
@plugin.
|
357
|
+
expect(@plugin).to receive(:remove_tag)
|
358
358
|
@plugin.__send__(:apply_plugin, '', true)
|
359
359
|
end
|
360
360
|
end
|
@@ -371,7 +371,7 @@ describe TDiary::Plugin do
|
|
371
371
|
subject { @plugin.__send__(:content_proc, 'key1', date) }
|
372
372
|
|
373
373
|
it 'add_content_procで登録したブロックのうち、keyに相当するものを実行すること' do
|
374
|
-
|
374
|
+
is_expected.to eq 'contents1'
|
375
375
|
end
|
376
376
|
|
377
377
|
context 'keyに相当するブロックが存在しない場合' do
|
@@ -30,7 +30,7 @@ describe TDiary::Rack::Assets::Precompile do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "JavaScript にコンパイルされる" do
|
33
|
-
FileTest.exist?("#{assets_path}/foo.js").
|
33
|
+
expect(FileTest.exist?("#{assets_path}/foo.js")).to be_truthy
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -46,7 +46,7 @@ describe TDiary::Rack::Assets::Precompile do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
it "JavaScript が更新される" do
|
49
|
-
@jstime.
|
49
|
+
expect(@jstime).to be < File.mtime("#{assets_path}/foo.js").to_i
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -61,7 +61,7 @@ describe TDiary::Rack::Assets::Precompile do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
it "JavaScript は更新されない" do
|
64
|
-
@jstime.
|
64
|
+
expect(@jstime).to eq(File.mtime("#{assets_path}/foo.js").to_i)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -11,47 +11,47 @@ describe TDiary::Rack::HtmlAnchor do
|
|
11
11
|
|
12
12
|
it 'should not do anything for root access' do
|
13
13
|
get '/'
|
14
|
-
last_request.params['date'].
|
15
|
-
last_request.query_string.
|
14
|
+
expect(last_request.params['date']).to eq(nil)
|
15
|
+
expect(last_request.query_string).to eq('')
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'should remove the file name from PATH_INFO' do
|
19
19
|
get '/20120501.html'
|
20
|
-
last_request.env['PATH_INFO'].
|
20
|
+
expect(last_request.env['PATH_INFO']).to eq('/')
|
21
21
|
get '/diary/20120501.html'
|
22
|
-
last_request.env['PATH_INFO'].
|
22
|
+
expect(last_request.env['PATH_INFO']).to eq('/diary/')
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should add date query' do
|
26
26
|
get '/diary/0501.html'
|
27
|
-
last_request.params['date'].
|
27
|
+
expect(last_request.params['date']).to eq("0501")
|
28
28
|
get '/0501.html'
|
29
|
-
last_request.params['date'].
|
29
|
+
expect(last_request.params['date']).to eq("0501")
|
30
30
|
get '/201205.html'
|
31
|
-
last_request.params['date'].
|
31
|
+
expect(last_request.params['date']).to eq("201205")
|
32
32
|
get '/20120501.html'
|
33
|
-
last_request.params['date'].
|
33
|
+
expect(last_request.params['date']).to eq("20120501")
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'should add date query when using section_permalink_anchor plugin' do
|
37
37
|
get '/20120501p01.html'
|
38
|
-
last_request.params['date'].
|
39
|
-
last_request.params['p'].
|
38
|
+
expect(last_request.params['date']).to eq("20120501")
|
39
|
+
expect(last_request.params['p']).to eq("01")
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should replace date query' do
|
43
43
|
get '/20120501.html?date=20120101'
|
44
|
-
last_request.params['date'].
|
44
|
+
expect(last_request.params['date']).to eq("20120501")
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'should not break original query' do
|
48
48
|
get '/?date=20120501'
|
49
|
-
last_request.params['date'].
|
49
|
+
expect(last_request.params['date']).to eq("20120501")
|
50
50
|
get '/index.rb?date=20120501'
|
51
|
-
last_request.params['date'].
|
51
|
+
expect(last_request.params['date']).to eq("20120501")
|
52
52
|
get '/index.rb?date=20120501&p=01'
|
53
|
-
last_request.params['date'].
|
54
|
-
last_request.params['p'].
|
53
|
+
expect(last_request.params['date']).to eq("20120501")
|
54
|
+
expect(last_request.params['p']).to eq("01")
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -11,17 +11,17 @@ describe TDiary::Rack::Static do
|
|
11
11
|
|
12
12
|
it 'should return the file in static directory' do
|
13
13
|
get '/README.md'
|
14
|
-
last_response.
|
14
|
+
expect(last_response).to be_ok
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should run the app if file is not exist' do
|
18
18
|
get '/index.rb'
|
19
|
-
last_response.status.
|
19
|
+
expect(last_response.status).to be 500
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should run the app when post method' do
|
23
23
|
post '/index.rb'
|
24
|
-
last_response.status.
|
24
|
+
expect(last_response.status).to be 500
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -11,57 +11,57 @@ describe TDiary::Rack::ValidRequestPath do
|
|
11
11
|
|
12
12
|
it 'should return 200 for latest' do
|
13
13
|
get '/'
|
14
|
-
last_response.
|
14
|
+
expect(last_response).to be_ok
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should return 200 for a nyear' do
|
18
18
|
get '/0501.html'
|
19
|
-
last_response.
|
19
|
+
expect(last_response).to be_ok
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should return 200 for a month' do
|
23
23
|
get '/201205.html'
|
24
|
-
last_response.
|
24
|
+
expect(last_response).to be_ok
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should return 200 for a day' do
|
28
28
|
get '/20120501.html'
|
29
|
-
last_response.
|
29
|
+
expect(last_response).to be_ok
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should return 200 for a day with section_permalink_anchor plugin' do
|
33
33
|
get '/20120501p01.html'
|
34
|
-
last_response.
|
34
|
+
expect(last_response).to be_ok
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should return 200 for a day with query' do
|
38
38
|
get '/?date=20120501'
|
39
|
-
last_response.
|
39
|
+
expect(last_response).to be_ok
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should return 200 for a day with query and section_permalink_anchor plugin' do
|
43
43
|
get '/?date=20120501&p=01'
|
44
|
-
last_response.
|
44
|
+
expect(last_response).to be_ok
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'should return 200 for a day with index.rb and query' do
|
48
48
|
get '/index.rb?date=20120501'
|
49
|
-
last_response.
|
49
|
+
expect(last_response).to be_ok
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'should return 404 for access to the invalid file' do
|
53
53
|
get '/20120501'
|
54
|
-
last_response.status.
|
54
|
+
expect(last_response.status).to be 404
|
55
55
|
get '/invalid'
|
56
|
-
last_response.status.
|
56
|
+
expect(last_response.status).to be 404
|
57
57
|
head '/invalid'
|
58
|
-
last_response.status.
|
59
|
-
last_response.body.length.
|
58
|
+
expect(last_response.status).to be 404
|
59
|
+
expect(last_response.body.length).to be 0
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'should return 404 for access to the invalid directory' do
|
63
63
|
get '/invalid/'
|
64
|
-
last_response.status.
|
64
|
+
expect(last_response.status).to eq(404)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -42,7 +42,7 @@ subTitle2
|
|
42
42
|
</div>
|
43
43
|
EOF
|
44
44
|
end
|
45
|
-
it { @diary.to_html.
|
45
|
+
it { expect(@diary.to_html).to eq @html.chomp }
|
46
46
|
end
|
47
47
|
|
48
48
|
context 'CHTML' do
|
@@ -56,12 +56,12 @@ subTitle2
|
|
56
56
|
<p>honbun</p><%= section_leave_proc( Time::at( 1041346800 ) ) %>
|
57
57
|
EOF
|
58
58
|
end
|
59
|
-
it { @diary.to_html({}, :CHTML).
|
59
|
+
it { expect(@diary.to_html({}, :CHTML)).to eq @html }
|
60
60
|
end
|
61
61
|
|
62
62
|
|
63
63
|
context 'to_src' do
|
64
|
-
it { @diary.to_src.
|
64
|
+
it { expect(@diary.to_src).to eq @source }
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -98,7 +98,7 @@ replaceTitle2
|
|
98
98
|
</div>
|
99
99
|
EOF
|
100
100
|
end
|
101
|
-
it { @diary.to_html.
|
101
|
+
it { expect(@diary.to_html).to eq @html.chomp }
|
102
102
|
end
|
103
103
|
|
104
104
|
describe '#add_section' do
|
@@ -122,7 +122,7 @@ subTitle
|
|
122
122
|
</div>
|
123
123
|
EOF
|
124
124
|
end
|
125
|
-
it { @diary.to_html.
|
125
|
+
it { expect(@diary.to_html).to eq @html.chomp }
|
126
126
|
end
|
127
127
|
|
128
128
|
describe '#delete_section' do
|
@@ -145,7 +145,7 @@ subTitle2
|
|
145
145
|
</div>
|
146
146
|
EOF
|
147
147
|
end
|
148
|
-
it { @diary.to_html.
|
148
|
+
it { expect(@diary.to_html).to eq @html.chomp }
|
149
149
|
end
|
150
150
|
|
151
151
|
describe 'test_tdiary_style2' do
|
@@ -167,7 +167,7 @@ subTitle2
|
|
167
167
|
</div>
|
168
168
|
EOF
|
169
169
|
end
|
170
|
-
it { @diary.to_html.
|
170
|
+
it { expect(@diary.to_html).to eq @html.chomp }
|
171
171
|
end
|
172
172
|
|
173
173
|
context 'CHTML' do
|
@@ -178,7 +178,7 @@ subTitle2
|
|
178
178
|
<p>honbun</p><%= section_leave_proc( Time::at( 1041346800 ) ) %>
|
179
179
|
EOF
|
180
180
|
end
|
181
|
-
it { @diary.to_html({}, :CHTML).
|
181
|
+
it { expect(@diary.to_html({}, :CHTML)).to eq @html }
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
@@ -215,7 +215,7 @@ ge%><%= section_leave_proc( Time::at( 1041346800 ) ) %>
|
|
215
215
|
</div>
|
216
216
|
EOF
|
217
217
|
end
|
218
|
-
it { @diary.to_html.
|
218
|
+
it { expect(@diary.to_html).to eq @html.chomp }
|
219
219
|
end
|
220
220
|
|
221
221
|
context 'CHTML' do
|
@@ -233,7 +233,7 @@ ge%>b
|
|
233
233
|
ge%><%= section_leave_proc( Time::at( 1041346800 ) ) %>
|
234
234
|
EOF
|
235
235
|
end
|
236
|
-
it { @diary.to_html({}, :CHTML).
|
236
|
+
it { expect(@diary.to_html({}, :CHTML)).to eq @html }
|
237
237
|
end
|
238
238
|
end
|
239
239
|
end
|