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
@@ -6,13 +6,13 @@ feature 'spamフィルタ設定の利用' do
|
|
6
6
|
visit '/update.rb?conf=sf'
|
7
7
|
|
8
8
|
page.all('div.saveconf').first.click_button 'OK'
|
9
|
-
page.
|
9
|
+
expect(page).not_to have_content '新入荷'
|
10
10
|
|
11
11
|
FileUtils.cp_r "#{TDiary::PATH}/spec/fixtures/sample.rb", "#{TDiary::PATH}/misc/filter/"
|
12
12
|
|
13
13
|
click_link 'スパムフィルター選択'
|
14
|
-
page.
|
15
|
-
page.
|
14
|
+
expect(page).to have_content '新入荷'
|
15
|
+
expect(page).to have_content 'sample.rb'
|
16
16
|
|
17
17
|
FileUtils.rm "#{TDiary::PATH}/misc/filter/sample.rb"
|
18
18
|
end
|
@@ -24,7 +24,7 @@ feature 'spamフィルタ設定の利用' do
|
|
24
24
|
check "sf.sample.rb"
|
25
25
|
page.all('div.saveconf').first.click_button 'OK'
|
26
26
|
|
27
|
-
page.
|
27
|
+
expect(page).to have_checked_field "sf.sample.rb"
|
28
28
|
|
29
29
|
FileUtils.rm "#{TDiary::PATH}/misc/filter/sample.rb"
|
30
30
|
end
|
@@ -33,11 +33,11 @@ feature 'spamフィルタ設定の利用' do
|
|
33
33
|
FileUtils.cp_r "#{TDiary::PATH}/spec/fixtures/sample.rb", "#{TDiary::PATH}/misc/filter/"
|
34
34
|
|
35
35
|
visit '/update.rb?conf=sf'
|
36
|
-
page.
|
36
|
+
expect(page).to have_content 'sample.rb'
|
37
37
|
|
38
38
|
FileUtils.rm "#{TDiary::PATH}/misc/filter/sample.rb"
|
39
39
|
click_link 'スパムフィルター選択'
|
40
|
-
page.
|
40
|
+
expect(page).not_to have_content 'sample.rb'
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -5,18 +5,18 @@ feature 'プラグイン選択設定の利用' do
|
|
5
5
|
plugin_path = "#{TDiary::PATH}/misc/plugin/rspec.rb"
|
6
6
|
|
7
7
|
scenario '新入荷のプラグインが表示される' do
|
8
|
-
FileUtils.rm plugin_path if File.
|
8
|
+
FileUtils.rm plugin_path if File.exist? plugin_path
|
9
9
|
|
10
10
|
visit '/update.rb?conf=sp'
|
11
11
|
page.all('div.saveconf').first.click_button 'OK'
|
12
|
-
page.
|
12
|
+
expect(page).not_to have_content '新入荷'
|
13
13
|
|
14
14
|
FileUtils.touch plugin_path
|
15
15
|
|
16
16
|
click_link 'プラグイン選択'
|
17
17
|
|
18
|
-
page.
|
19
|
-
page.
|
18
|
+
expect(page).to have_content '新入荷'
|
19
|
+
expect(page).to have_content 'rspec.rb'
|
20
20
|
|
21
21
|
FileUtils.rm plugin_path
|
22
22
|
end
|
@@ -29,7 +29,7 @@ feature 'プラグイン選択設定の利用' do
|
|
29
29
|
check "sp.rspec.rb"
|
30
30
|
page.all('div.saveconf').first.click_button 'OK'
|
31
31
|
|
32
|
-
page.
|
32
|
+
expect(page).to have_checked_field "sp.rspec.rb"
|
33
33
|
|
34
34
|
FileUtils.rm plugin_path
|
35
35
|
end
|
@@ -38,12 +38,12 @@ feature 'プラグイン選択設定の利用' do
|
|
38
38
|
FileUtils.touch plugin_path
|
39
39
|
|
40
40
|
visit '/update.rb?conf=sp'
|
41
|
-
page.
|
41
|
+
expect(page).to have_content 'rspec.rb'
|
42
42
|
|
43
43
|
FileUtils.rm plugin_path
|
44
44
|
|
45
45
|
click_link 'プラグイン選択'
|
46
|
-
page.
|
46
|
+
expect(page).not_to have_content 'rspec.rb'
|
47
47
|
end
|
48
48
|
|
49
49
|
scenario '外部の Javascript を追加するプラグインを有効にする' do
|
@@ -54,10 +54,10 @@ feature 'プラグイン選択設定の利用' do
|
|
54
54
|
|
55
55
|
visit '/update.rb'
|
56
56
|
|
57
|
-
page.body.
|
58
|
-
page.body.
|
59
|
-
page.body.
|
60
|
-
page.body.
|
57
|
+
expect(page.body).to be_include('caretposition.js')
|
58
|
+
expect(page.body).to be_include('category_autocomplete.js')
|
59
|
+
expect(page.body).to be_include('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js')
|
60
|
+
expect(page.body).not_to be_include('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js?')
|
61
61
|
end
|
62
62
|
end
|
63
63
|
# Local Variables:
|
@@ -13,7 +13,7 @@ feature 'リンク元設定の利用' do
|
|
13
13
|
click_link '最新'
|
14
14
|
today = Date.today.strftime("%Y年%m月%d日")
|
15
15
|
page.find('h2', text: today).click_link today
|
16
|
-
within('div.day') { page.
|
16
|
+
within('div.day') { expect(page).to have_no_css('div[class="refererlist"]') }
|
17
17
|
end
|
18
18
|
|
19
19
|
scenario 'リンク元記録の除外設定が動いている' do
|
@@ -27,7 +27,7 @@ feature 'リンク元設定の利用' do
|
|
27
27
|
click_link '最新'
|
28
28
|
today = Date.today.strftime('%Y年%m月%d日')
|
29
29
|
page.find('h2', text: today).click_link today
|
30
|
-
within('div.day div.refererlist') { page.
|
30
|
+
within('div.day div.refererlist') { expect(page).to have_no_link('http://www.example.com') }
|
31
31
|
end
|
32
32
|
|
33
33
|
scenario 'リンク元の置換が動いている', :exclude_selenium do
|
@@ -45,8 +45,8 @@ REFERER
|
|
45
45
|
today = Date.today.strftime('%Y年%m月%d日')
|
46
46
|
page.find('h2', text: today).click_link today
|
47
47
|
within('div.day div.refererlist') {
|
48
|
-
page.
|
49
|
-
page.
|
48
|
+
expect(page).to have_link "alice"
|
49
|
+
expect(page).to have_no_link "http://www.example.com"
|
50
50
|
}
|
51
51
|
end
|
52
52
|
end
|
@@ -11,7 +11,7 @@ feature 'spamフィルタ設定の利用' do
|
|
11
11
|
page.all('div.saveconf').first.click_button 'OK'
|
12
12
|
|
13
13
|
visit '/update.rb?conf=sp'
|
14
|
-
page.
|
14
|
+
expect(page).to have_checked_field 'sp.hide-mail-field.rb'
|
15
15
|
end
|
16
16
|
|
17
17
|
scenario 'CSRF対策の設定が保存される' do
|
@@ -23,7 +23,7 @@ feature 'spamフィルタ設定の利用' do
|
|
23
23
|
page.all('div.saveconf').first.click_button 'OK'
|
24
24
|
|
25
25
|
visit '/update.rb?conf=csrf_protection'
|
26
|
-
page.
|
26
|
+
expect(page).to have_selector 'input[name="check_key"][value="true"][checked]'
|
27
27
|
end
|
28
28
|
|
29
29
|
scenario 'spamと判定されたツッコミを捨てる' do
|
@@ -50,8 +50,8 @@ BODY
|
|
50
50
|
fill_in "day", with: Date.today.day
|
51
51
|
click_button 'この日付の日記を編集'
|
52
52
|
|
53
|
-
page.
|
54
|
-
page.
|
53
|
+
expect(page).to have_no_content "alpha"
|
54
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
55
55
|
end
|
56
56
|
|
57
57
|
scenario 'URLの数によるspam判定' do
|
@@ -81,10 +81,10 @@ BODY
|
|
81
81
|
click_button '投稿'
|
82
82
|
|
83
83
|
visit "/"
|
84
|
-
page.
|
85
|
-
page.
|
86
|
-
page.
|
87
|
-
page.
|
84
|
+
expect(page).to have_no_content "alpha"
|
85
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
86
|
+
expect(page).to have_content "bravo"
|
87
|
+
expect(page).to have_content "こんばんは!こんばんは!"
|
88
88
|
end
|
89
89
|
|
90
90
|
scenario 'URLの割合によるspam判定' do
|
@@ -119,10 +119,10 @@ BODY
|
|
119
119
|
click_button '投稿'
|
120
120
|
|
121
121
|
visit "/"
|
122
|
-
page.
|
123
|
-
page.
|
124
|
-
page.
|
125
|
-
page.
|
122
|
+
expect(page).to have_no_content "alpha"
|
123
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
124
|
+
expect(page).to have_content "bravo"
|
125
|
+
expect(page).to have_content "こんばんは!こんばんは!"
|
126
126
|
end
|
127
127
|
|
128
128
|
scenario 'キーワードでツッコミがはじかれる' do
|
@@ -144,8 +144,8 @@ BODY
|
|
144
144
|
click_button '投稿'
|
145
145
|
|
146
146
|
visit "/"
|
147
|
-
page.
|
148
|
-
page.
|
147
|
+
expect(page).to have_no_content "alpha"
|
148
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
149
149
|
end
|
150
150
|
|
151
151
|
scenario 'メールアドレスでツッコミがはじかれる' do
|
@@ -176,10 +176,10 @@ BODY
|
|
176
176
|
click_button '投稿'
|
177
177
|
|
178
178
|
visit "/"
|
179
|
-
page.
|
180
|
-
page.
|
181
|
-
page.
|
182
|
-
page.
|
179
|
+
expect(page).to have_no_content "alpha"
|
180
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
181
|
+
expect(page).to have_content "bravo"
|
182
|
+
expect(page).to have_content "こんばんは!こんばんは!"
|
183
183
|
|
184
184
|
end
|
185
185
|
|
@@ -209,10 +209,10 @@ BODY
|
|
209
209
|
click_button '投稿'
|
210
210
|
|
211
211
|
visit "/"
|
212
|
-
page.
|
213
|
-
page.
|
214
|
-
page.
|
215
|
-
page.
|
212
|
+
expect(page).to have_no_content "alpha"
|
213
|
+
expect(page).to have_no_content "こんにちは! http://www.example.com"
|
214
|
+
expect(page).to have_content "bravo"
|
215
|
+
expect(page).to have_content "example こんにちは!"
|
216
216
|
end
|
217
217
|
|
218
218
|
scenario 'IPアドレスでツッコミが弾かれる' do
|
@@ -233,8 +233,8 @@ BODY
|
|
233
233
|
click_button '投稿'
|
234
234
|
|
235
235
|
visit "/"
|
236
|
-
page.
|
237
|
-
page.
|
236
|
+
expect(page).to have_no_content "alpha"
|
237
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
238
238
|
end
|
239
239
|
|
240
240
|
scenario 'ツッコミの注意文が保存されて表示される' do
|
@@ -246,27 +246,27 @@ BODY
|
|
246
246
|
|
247
247
|
visit "/"
|
248
248
|
click_link 'ツッコミを入れる'
|
249
|
-
page.
|
249
|
+
expect(page).to have_content 'これはツッコミの注意文です'
|
250
250
|
end
|
251
251
|
|
252
252
|
scenario 'スパムフィルターのログ記録の設定ができない', :exclude_no_secure do
|
253
253
|
append_default_diary
|
254
254
|
|
255
255
|
visit '/update.rb?conf=spamfilter'
|
256
|
-
page.
|
256
|
+
expect(page).not_to have_field 'filter.debug_mode'
|
257
257
|
end
|
258
258
|
|
259
259
|
scenario 'スパムフィルターのログ記録の設定が保存される', :exclude_secure do
|
260
260
|
append_default_diary
|
261
261
|
|
262
262
|
visit '/update.rb?conf=spamfilter'
|
263
|
-
page.
|
263
|
+
expect(page).to have_field 'filter.debug_mode'
|
264
264
|
select '記録しない', from: 'filter.debug_mode'
|
265
265
|
page.all('div.saveconf').first.click_button 'OK'
|
266
266
|
|
267
267
|
visit '/update.rb?conf=spamfilter'
|
268
268
|
within('select[name="filter.debug_mode"] option[selected]'){
|
269
|
-
page.
|
269
|
+
expect(page).to have_content '記録しない'
|
270
270
|
}
|
271
271
|
end
|
272
272
|
end
|
@@ -20,13 +20,13 @@ BODY
|
|
20
20
|
|
21
21
|
visit '/'
|
22
22
|
page.find('h2', text: '2001年04月23日').click_link '2001年04月23日'
|
23
|
-
within('div.day span.title'){ page.
|
23
|
+
within('div.day span.title'){ expect(page).to have_content "tDiaryのテスト" }
|
24
24
|
within('div.body'){
|
25
|
-
page.
|
26
|
-
page.
|
25
|
+
expect(page).to have_content "さて、テストである。"
|
26
|
+
expect(page).to have_content "もう一度テストである。"
|
27
27
|
|
28
|
-
page.
|
29
|
-
page.
|
28
|
+
expect(page).to have_content "とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P"
|
29
|
+
expect(page).to have_content "本当に動くかな?"
|
30
30
|
}
|
31
31
|
|
32
32
|
visit '/update.rb'
|
@@ -44,13 +44,13 @@ BODY
|
|
44
44
|
|
45
45
|
visit '/'
|
46
46
|
page.find('h2', text: '2001年04月23日').click_link '2001年04月23日'
|
47
|
-
within('div.day span.title'){ page.
|
47
|
+
within('div.day span.title'){ expect(page).to have_content "tDiaryのテスト" }
|
48
48
|
within('div.body'){
|
49
|
-
page.
|
50
|
-
page.
|
49
|
+
expect(page).to have_no_content "さて、テストである。"
|
50
|
+
expect(page).to have_content "もう一度テストである。"
|
51
51
|
|
52
|
-
page.
|
53
|
-
page.
|
52
|
+
expect(page).to have_no_content "とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P"
|
53
|
+
expect(page).to have_content "本当に動くかな?"
|
54
54
|
}
|
55
55
|
end
|
56
56
|
|
@@ -66,10 +66,10 @@ BODY
|
|
66
66
|
within('div.textarea') { fill_in "body", with: '' }
|
67
67
|
|
68
68
|
click_button "登録"
|
69
|
-
page.
|
69
|
+
expect(page).to have_content "Click here!"
|
70
70
|
|
71
71
|
visit '/'
|
72
|
-
within('div.day') { page.
|
72
|
+
within('div.day') { expect(page).to have_no_css('h3') }
|
73
73
|
end
|
74
74
|
|
75
75
|
scenario '日記を隠す' do
|
@@ -83,10 +83,10 @@ BODY
|
|
83
83
|
check 'hide'
|
84
84
|
|
85
85
|
click_button "登録"
|
86
|
-
page.
|
86
|
+
expect(page).to have_content "Click here!"
|
87
87
|
|
88
88
|
visit '/'
|
89
|
-
page.
|
89
|
+
expect(page).to have_no_css('div[class="day"]')
|
90
90
|
end
|
91
91
|
|
92
92
|
scenario '編集画面に前の日記と次の日記のリンク表示される' do
|
@@ -100,8 +100,8 @@ BODY
|
|
100
100
|
fill_in "day", with: '3'
|
101
101
|
click_button 'この日付の日記を編集'
|
102
102
|
|
103
|
-
page.
|
104
|
-
page.
|
103
|
+
expect(page).to have_content('«前の日記(2001年05月02日)')
|
104
|
+
expect(page).to have_content('次の日記(2001年05月04日)»')
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -12,13 +12,13 @@ feature 'ツッコミの表示' do
|
|
12
12
|
uncheck 'commentcheckboxr0'
|
13
13
|
click_button 'ツッコミ表示状態変更'
|
14
14
|
visit '/'
|
15
|
-
page.
|
16
|
-
page.
|
15
|
+
expect(page).to have_no_content "alpha"
|
16
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
17
17
|
|
18
18
|
today = Date.today.strftime("%Y年%m月%d日")
|
19
19
|
page.find('h2', text: today).click_link today
|
20
|
-
page.
|
21
|
-
page.
|
20
|
+
expect(page).to have_no_content "alpha"
|
21
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
22
22
|
end
|
23
23
|
|
24
24
|
scenario "日付表示だと絵文字を表示できる", :exclude_selenium do
|
@@ -36,7 +36,7 @@ BODY
|
|
36
36
|
today = Date.today.strftime("%Y年%m月%d日")
|
37
37
|
page.find('h2', text: today).click_link today
|
38
38
|
within('div.day div.comment div.commentbody') {
|
39
|
-
page.body.
|
39
|
+
expect(page.body).to be_include "<img src='http://www.emoji-cheat-sheet.com/graphics/emojis/sushi.png' width='20' height='20' title='sushi' alt='sushi' class='emoji' /> は美味しい"
|
40
40
|
}
|
41
41
|
end
|
42
42
|
|
@@ -53,7 +53,7 @@ BODY
|
|
53
53
|
|
54
54
|
visit "/"
|
55
55
|
within('div.day div.comment div.commentshort') {
|
56
|
-
page.body.
|
56
|
+
expect(page.body).to be_include "<img src='http://www.emoji-cheat-sheet.com/graphics/emojis/sushi.png' width='20' height='20' title='sushi' alt='sushi' class='emoji' /> は美味しい"
|
57
57
|
}
|
58
58
|
end
|
59
59
|
end
|
@@ -6,9 +6,9 @@ feature '日記を読む' do
|
|
6
6
|
visit '/'
|
7
7
|
# capybara-2.0 can't find header content.
|
8
8
|
# within('title') { page.should have_content('【日記のタイトル】') }
|
9
|
-
within('h1') { page.
|
10
|
-
page.
|
11
|
-
page.
|
9
|
+
within('h1') { expect(page).to have_content('【日記のタイトル】') }
|
10
|
+
expect(page).to have_css('a[href="update.rb"]')
|
11
|
+
expect(page).to have_css('a[href="update.rb?conf=default"]')
|
12
12
|
end
|
13
13
|
|
14
14
|
scenario '月またぎの日記の表示' do
|
@@ -20,14 +20,14 @@ feature '日記を読む' do
|
|
20
20
|
|
21
21
|
visit '/'
|
22
22
|
page.find('h2', text: before_day).click_link "#{before_day}"
|
23
|
-
within('div.adminmenu'){ page.
|
23
|
+
within('div.adminmenu'){ expect(page).to have_content "次の日記(#{after_day})"}
|
24
24
|
|
25
25
|
click_link "次の日記(#{after_day})"
|
26
|
-
within('div.day') { page.
|
27
|
-
within('div.adminmenu'){ page.
|
26
|
+
within('div.day') { expect(page).to have_content "#{after_day}" }
|
27
|
+
within('div.adminmenu'){ expect(page).to have_content "前の日記(#{before_day})"}
|
28
28
|
|
29
29
|
click_link "前の日記(#{before_day})"
|
30
|
-
within('div.day') { page.
|
30
|
+
within('div.day') { expect(page).to have_content "#{before_day}" }
|
31
31
|
end
|
32
32
|
|
33
33
|
scenario 'n日前の日記をまとめて表示' do
|
@@ -35,16 +35,16 @@ feature '日記を読む' do
|
|
35
35
|
|
36
36
|
visit '/'
|
37
37
|
within('div.main') {
|
38
|
-
page.
|
39
|
-
page.
|
40
|
-
page.
|
38
|
+
expect(page).to have_content "#{Date.parse('20100502').strftime('%Y年%m月%d日')}"
|
39
|
+
expect(page).to have_content "#{Date.parse('20100511').strftime('%Y年%m月%d日')}"
|
40
|
+
expect(page).to have_no_content "#{Date.parse('20100501').strftime('%Y年%m月%d日')}"
|
41
41
|
}
|
42
42
|
|
43
43
|
click_link "前10日分"
|
44
44
|
within('div.main') {
|
45
|
-
page.
|
46
|
-
page.
|
47
|
-
page.
|
45
|
+
expect(page).to have_no_content "#{Date.parse('20100502').strftime('%Y年%m月%d日')}"
|
46
|
+
expect(page).to have_no_content "#{Date.parse('20100511').strftime('%Y年%m月%d日')}"
|
47
|
+
expect(page).to have_content "#{Date.parse('20100501').strftime('%Y年%m月%d日')}"
|
48
48
|
}
|
49
49
|
end
|
50
50
|
|
@@ -58,19 +58,19 @@ feature '日記を読む' do
|
|
58
58
|
click_link '長年日記'
|
59
59
|
|
60
60
|
titles = page.all('h2 span.date a').map{|t| t.text }
|
61
|
-
titles.
|
62
|
-
titles.
|
63
|
-
titles.
|
61
|
+
expect(titles).to include '2001年04月23日'
|
62
|
+
expect(titles).to include '2002年04月23日'
|
63
|
+
expect(titles).to include '2003年04月23日'
|
64
64
|
end
|
65
65
|
|
66
66
|
scenario '指定をした日を表示' do
|
67
67
|
append_default_diary('2001-04-23')
|
68
68
|
|
69
69
|
visit '/?date=20010423'
|
70
|
-
within('div.day span.title'){ page.
|
70
|
+
within('div.day span.title'){ expect(page).to have_content "tDiaryのテスト" }
|
71
71
|
within('div.day div.section'){
|
72
|
-
within('h3') { page.
|
73
|
-
page.
|
72
|
+
within('h3') { expect(page).to have_content "さて、テストである。" }
|
73
|
+
expect(page).to have_content "とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P"
|
74
74
|
}
|
75
75
|
end
|
76
76
|
|
@@ -107,12 +107,12 @@ BODY
|
|
107
107
|
|
108
108
|
visit '/?date=200101'
|
109
109
|
within('div.main'){
|
110
|
-
page.
|
111
|
-
page.
|
112
|
-
page.
|
113
|
-
page.
|
114
|
-
page.
|
115
|
-
page.
|
110
|
+
expect(page).to have_content "さて、テストである。"
|
111
|
+
expect(page).to have_content "さて、月末である。"
|
112
|
+
expect(page).to have_no_content "さて、月始めである。"
|
113
|
+
expect(page).to have_content "とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P"
|
114
|
+
expect(page).to have_content "今月も終わる"
|
115
|
+
expect(page).to have_no_content "今月も始まる"
|
116
116
|
}
|
117
117
|
end
|
118
118
|
end
|
@@ -8,8 +8,8 @@ feature 'リンク元の表示', exclude_selenium: true do
|
|
8
8
|
today = Date.today.strftime("%Y年%m月%d日")
|
9
9
|
page.find('h2', text: today).click_link today
|
10
10
|
within('div.day') {
|
11
|
-
page.
|
12
|
-
within('div.refererlist') { page.
|
11
|
+
expect(page).to have_css('div[class="refererlist"]')
|
12
|
+
within('div.refererlist') { expect(page).to have_content "http://www.example.com" }
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
@@ -18,7 +18,7 @@ feature 'リンク元の表示', exclude_selenium: true do
|
|
18
18
|
visit "/"
|
19
19
|
today = Date.today.strftime("%Y年%m月%d日")
|
20
20
|
page.find('h2', text: today).click_link today
|
21
|
-
within('div.day div.refererlist') { page.
|
21
|
+
within('div.day div.refererlist') { expect(page).to have_link "http://www.example.com" }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -26,19 +26,19 @@ describe PStore, "auto convert library" do
|
|
26
26
|
|
27
27
|
it "should convert an encoding to UTF-8 automatically" do
|
28
28
|
PStore.new(@dbfile).transaction do |db|
|
29
|
-
db["key1"].encoding.
|
30
|
-
db["key2"].
|
31
|
-
db["key3"][2].encoding.
|
29
|
+
expect(db["key1"].encoding).to eq(Encoding::UTF_8)
|
30
|
+
expect(db["key2"]).to eq(2)
|
31
|
+
expect(db["key3"][2].encoding).to eq(Encoding::UTF_8)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
it "1回目のtransactionではMashal.loadが3回呼ばれる" do
|
36
|
-
Marshal.
|
36
|
+
expect(Marshal).to receive(:load).exactly(3).and_return({})
|
37
37
|
PStore.new(@dbfile).transaction {}
|
38
38
|
end
|
39
39
|
|
40
40
|
it "2回目のtransactionではMashal.loadが1回だけ呼ばれる" do
|
41
|
-
Marshal.
|
41
|
+
expect(Marshal).to receive(:load).exactly(4).and_return({})
|
42
42
|
PStore.new(@dbfile).transaction {}
|
43
43
|
PStore.new(@dbfile).transaction {}
|
44
44
|
end
|
@@ -20,13 +20,13 @@ describe TDiary::Configuration do
|
|
20
20
|
@obj = TDiary.configuration
|
21
21
|
end
|
22
22
|
|
23
|
-
it { @obj.class.
|
23
|
+
it { expect(@obj.class).to eq TDiary::Configuration }
|
24
24
|
it "singleton" do
|
25
|
-
@obj.
|
25
|
+
expect(@obj).to eq TDiary.configuration
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
it "TDiary.configuration.attribute" do
|
30
|
-
TDiary.configuration.style.
|
30
|
+
expect(TDiary.configuration.style).to eq("Wiki")
|
31
31
|
end
|
32
32
|
end
|
data/spec/core/core_ext_spec.rb
CHANGED
@@ -6,15 +6,15 @@ require 'tdiary/core_ext'
|
|
6
6
|
describe "core extension library" do
|
7
7
|
describe 'String#make_link' do
|
8
8
|
it 'エスケープされて出力される' do
|
9
|
-
"<\"alice&bob\">".make_link.
|
9
|
+
expect("<\"alice&bob\">".make_link).to eq "<"alice&bob">"
|
10
10
|
end
|
11
11
|
|
12
12
|
context 'httpを含む場合' do
|
13
|
-
it { "http://example.com".make_link.
|
13
|
+
it { expect("http://example.com".make_link).to eq "<a href=\"http://example.com\">http://example.com</a>" }
|
14
14
|
end
|
15
15
|
|
16
16
|
context 'メールアドレスのようなものを含む場合' do
|
17
|
-
it { "shibata.hiroshi@gmail.com".make_link.
|
17
|
+
it { expect("shibata.hiroshi@gmail.com".make_link).to eq "<a href=\"mailto:shibata.hiroshi@gmail.com\">shibata.hiroshi@gmail.com</a>" }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -22,21 +22,21 @@ describe "core extension library" do
|
|
22
22
|
context "emojify" do
|
23
23
|
before { @result = ":sushi: は美味しい".emojify }
|
24
24
|
it do
|
25
|
-
@result.
|
25
|
+
expect(@result).to eq "<img src='http://www.emoji-cheat-sheet.com/graphics/emojis/sushi.png' width='20' height='20' title='sushi' alt='sushi' class='emoji' /> は美味しい"
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
context "大文字でもemojify" do
|
30
30
|
before { @result = ":SUSHI: は美味しい".emojify }
|
31
31
|
it do
|
32
|
-
@result.
|
32
|
+
expect(@result).to eq "<img src='http://www.emoji-cheat-sheet.com/graphics/emojis/sushi.png' width='20' height='20' title='sushi' alt='sushi' class='emoji' /> は美味しい"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
context "+1でもemojify" do
|
37
37
|
before { @result = "いいね!:+1:".emojify }
|
38
38
|
it do
|
39
|
-
@result.
|
39
|
+
expect(@result).to eq "いいね!<img src='http://www.emoji-cheat-sheet.com/graphics/emojis/plus1.png' width='20' height='20' title='plus1' alt='plus1' class='emoji' />"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -45,7 +45,7 @@ describe "core extension library" do
|
|
45
45
|
@result = ":<script type='text/javascript'></script>: は美味しい".emojify
|
46
46
|
end
|
47
47
|
it do
|
48
|
-
@result.
|
48
|
+
expect(@result).to eq ":<script type='text/javascript'></script>: は美味しい"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -5,7 +5,7 @@ require 'tdiary/io/default'
|
|
5
5
|
|
6
6
|
describe TDiary::IO::Default do
|
7
7
|
it 'is_a TDiary::IO::Base' do
|
8
|
-
expect { TDiary::IO::Default.is_a?(TDiary::IO::Base) }.to
|
8
|
+
expect { TDiary::IO::Default.is_a?(TDiary::IO::Base) }.to be_truthy
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "#save_cgi_conf and #load_cgi_conf" do
|