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/plugin/00default.rb
CHANGED
@@ -397,7 +397,12 @@ def css_tag
|
|
397
397
|
if @mode =~ /conf$/ then
|
398
398
|
css = "#{h theme_url}/conf.css"
|
399
399
|
elsif @conf.theme and @conf.theme.length > 0
|
400
|
-
|
400
|
+
location, name = @conf.theme.split(/\//, 2)
|
401
|
+
unless name
|
402
|
+
name = location
|
403
|
+
location = 'local'
|
404
|
+
end
|
405
|
+
css = __send__("theme_url_#{location}", name)
|
401
406
|
else
|
402
407
|
css = @conf.css
|
403
408
|
end
|
@@ -414,7 +419,7 @@ def smartphone_tag
|
|
414
419
|
<<-CSS
|
415
420
|
<meta name = "viewport" content = "width = device-width">
|
416
421
|
<style type="text/css"><!--
|
417
|
-
form.comment textarea {
|
422
|
+
form.comment textarea {
|
418
423
|
width: 80%;
|
419
424
|
}
|
420
425
|
--></style>
|
@@ -443,7 +448,7 @@ def title_of_day( date, title )
|
|
443
448
|
r = <<-HTML
|
444
449
|
<span class="date">
|
445
450
|
<a href="#{h @conf.index}#{anchor( date.strftime( '%Y%m%d' ) )}">#{date.strftime @conf.date_format}</a>
|
446
|
-
</span>
|
451
|
+
</span>
|
447
452
|
<span class="title">#{title}</span>
|
448
453
|
HTML
|
449
454
|
return r.gsub( /^\t+/, '' ).chomp
|
@@ -455,7 +460,6 @@ end
|
|
455
460
|
|
456
461
|
def nyear_link( date, title )
|
457
462
|
if @conf.show_nyear and @mode != 'nyear' and !@cgi.mobile_agent? then
|
458
|
-
y = date.strftime( '%Y' )
|
459
463
|
m = date.strftime( '%m' )
|
460
464
|
d = date.strftime( '%d' )
|
461
465
|
years = @years.find_all {|year, months| months.include? m}
|
@@ -533,7 +537,7 @@ end
|
|
533
537
|
# make anchor tag in my diary
|
534
538
|
#
|
535
539
|
def my( a, str, title = nil )
|
536
|
-
date,
|
540
|
+
date, _, frag = a.scan( /^(\d{4}|\d{6}|\d{8}|\d{8}-\d+)([^\d]*)?#?([pct]\d+)?$/ )[0]
|
537
541
|
anc = frag ? "#{date}#{frag}" : date
|
538
542
|
index = /^https?:/ =~ @conf.index ? '' : base_url
|
539
543
|
index += @conf.index.sub(%r|^\./|, '')
|
@@ -710,7 +714,7 @@ def comment_mail_send
|
|
710
714
|
mail = @comment.mail
|
711
715
|
mail = @conf.author_mail unless mail =~ %r<[0-9a-zA-Z_.-]+@[\(\)%!0-9a-zA-Z_$@.&+-,'"*-]+>
|
712
716
|
mail = receivers[0] if mail.empty?
|
713
|
-
|
717
|
+
|
714
718
|
now = Time::now
|
715
719
|
g = now.dup.gmtime
|
716
720
|
l = Time::local( g.year, g.month, g.day, g.hour, g.min, g.sec )
|
@@ -816,7 +820,7 @@ end
|
|
816
820
|
# themes
|
817
821
|
def conf_theme_list
|
818
822
|
r = ''
|
819
|
-
t =
|
823
|
+
t = -1
|
820
824
|
@conf_theme_list.each_with_index do |theme, index|
|
821
825
|
if theme[0] == @conf.theme then
|
822
826
|
select = " selected"
|
@@ -824,40 +828,43 @@ def conf_theme_list
|
|
824
828
|
end
|
825
829
|
r << %Q|<option value="#{h theme[0]}"#{select}>#{theme[1]}</option>|
|
826
830
|
end
|
827
|
-
img = t ==
|
831
|
+
img = t == -1 ? 'nowprinting' : @conf.theme.sub(/^.*\//, '')
|
828
832
|
r << <<-HTML
|
829
833
|
</select>
|
830
|
-
<input name="css" size="
|
834
|
+
<input name="css" size="30" value="#{h @conf.css}">
|
831
835
|
</p>
|
832
836
|
<p><img id="theme_thumbnail" src="http://www.tdiary.org/theme.image/#{img}.jpg" alt="#{@theme_thumbnail_label}"></p>
|
833
|
-
<script language="JavaScript"><!--
|
834
|
-
function changeTheme( image, list ) {
|
835
|
-
var theme = '';
|
836
|
-
if ( list.selectedIndex == 0 ) {
|
837
|
-
theme = 'nowprinting';
|
838
|
-
} else {
|
839
|
-
theme = list.options[list.selectedIndex].value;
|
840
|
-
}
|
841
|
-
image.src = 'http://www.tdiary.org/theme.image/' + theme + '.jpg'
|
842
|
-
}
|
843
|
-
--></script>
|
844
837
|
#{@theme_location_comment unless @cgi.mobile_agent?}
|
845
838
|
HTML
|
846
839
|
end
|
847
840
|
|
841
|
+
def theme_list_local(list)
|
842
|
+
theme_paths = [::TDiary::PATH, TDiary.server_root].map {|d| "#{d}/theme/*" }
|
843
|
+
Dir::glob( theme_paths ).sort.map {|dir|
|
844
|
+
theme = dir.sub( %r[.*/theme/], '')
|
845
|
+
next unless FileTest::file?( "#{dir}/#{theme}.css".untaint )
|
846
|
+
name = theme.split( /_/ ).collect{|s| s.capitalize}.join( ' ' )
|
847
|
+
list << ["local/#{theme}",name]
|
848
|
+
}
|
849
|
+
list
|
850
|
+
end
|
851
|
+
|
852
|
+
def theme_url_local(theme)
|
853
|
+
"#{h theme_url}/#{h theme}/#{h theme}.css"
|
854
|
+
end
|
855
|
+
|
848
856
|
def saveconf_theme
|
849
857
|
if @mode == 'saveconf' then
|
850
858
|
@conf.theme = @cgi.params['theme'][0]
|
851
859
|
@conf.css = @cgi.params['css'][0]
|
852
860
|
end
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
}.compact.uniq
|
861
|
+
@conf_theme_list = methods.inject([]) {|conf_theme_list, method|
|
862
|
+
if /^theme_list_/ =~ method.to_s
|
863
|
+
__send__(method, conf_theme_list)
|
864
|
+
else
|
865
|
+
conf_theme_list
|
866
|
+
end
|
867
|
+
}.sort.compact.uniq
|
861
868
|
end
|
862
869
|
|
863
870
|
# comments
|
data/plugin/50sp.rb
CHANGED
data/plugin/60sf.rb
CHANGED
data/plugin/90migrate.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
if !@conf.tdiary_version && @conf.io_class.to_s == 'TDiary::IO::Default'
|
7
7
|
def convert_pstore( file )
|
8
8
|
require "pstore"
|
9
|
-
|
9
|
+
|
10
10
|
db = PStore.new( file )
|
11
11
|
begin
|
12
12
|
roots = db.transaction{ db.roots }
|
@@ -27,7 +27,7 @@ if !@conf.tdiary_version && @conf.io_class.to_s == 'TDiary::IO::Default'
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def convert_element( data )
|
32
32
|
case data
|
33
33
|
when Hash, Array
|
data/plugin/en/00default.rb
CHANGED
@@ -233,7 +233,7 @@ add_conf_proc( 'theme', 'Themes', 'theme' ) do
|
|
233
233
|
<h3 class="subtitle">Theme</h3>
|
234
234
|
#{"<p>Specify the design of your diary using Theme or CSS. When you select \"CSS specify\", input URL of CSS into the field right side.</p>" unless @cgi.mobile_agent?}
|
235
235
|
<p>
|
236
|
-
<select name="theme"
|
236
|
+
<select name="theme" id="theme_selection">
|
237
237
|
<option value="">CSS Specify-></option>
|
238
238
|
HTML
|
239
239
|
r << conf_theme_list
|
data/plugin/ja/00default.rb
CHANGED
@@ -265,7 +265,7 @@ add_conf_proc( 'theme', 'テーマ選択', 'theme' ) do
|
|
265
265
|
<h3 class="subtitle">テーマの指定</h3>
|
266
266
|
#{"<p>日記のデザインをテーマ、もしくはCSSの直接入力で指定します。ドロップダウンメニューから「CSS指定→」を選択した場合には、右の欄にCSSのURLを入力してください。</p>" unless @cgi.mobile_agent?}
|
267
267
|
<p>
|
268
|
-
<select name="theme"
|
268
|
+
<select name="theme" id="theme_selection">
|
269
269
|
<option value="">CSS指定→</option>
|
270
270
|
HTML
|
271
271
|
r << conf_theme_list
|
@@ -12,24 +12,24 @@ feature 'ツッコミの更新' do
|
|
12
12
|
BODY
|
13
13
|
|
14
14
|
click_button '投稿'
|
15
|
-
page.
|
15
|
+
expect(page).to have_content "Click here!"
|
16
16
|
|
17
17
|
visit "/"
|
18
18
|
within('div.day div.comment div.commentshort') {
|
19
19
|
within('span.commentator') {
|
20
|
-
page.
|
20
|
+
expect(page).to have_content "alpha"
|
21
21
|
}
|
22
|
-
page.
|
22
|
+
expect(page).to have_content "こんにちは!こんにちは!"
|
23
23
|
}
|
24
24
|
today = Date.today.strftime('%Y年%m月%d日')
|
25
25
|
page.find('h2', text: today).click_link today
|
26
26
|
within('div.day div.comment div.commentbody') {
|
27
27
|
within('div.commentator'){
|
28
28
|
t = Time.now
|
29
|
-
within('span.commenttime'){ page.
|
30
|
-
within('span.commentator'){ page.
|
29
|
+
within('span.commenttime'){ expect(page).to have_content "%04d年%02d月%02d日" % [t.year, t.month, t.day] }
|
30
|
+
within('span.commentator'){ expect(page).to have_content "alpha" }
|
31
31
|
}
|
32
|
-
page.
|
32
|
+
expect(page).to have_content "こんにちは!こんにちは!"
|
33
33
|
}
|
34
34
|
end
|
35
35
|
|
@@ -44,25 +44,25 @@ BODY
|
|
44
44
|
BODY
|
45
45
|
|
46
46
|
click_button '投稿'
|
47
|
-
page.
|
47
|
+
expect(page).to have_content "Click here!"
|
48
48
|
|
49
49
|
visit "/"
|
50
50
|
within('div.day div.comment div.commentshort') {
|
51
|
-
page.
|
52
|
-
page.
|
53
|
-
page.
|
54
|
-
page.
|
51
|
+
expect(page).to have_content "alpha"
|
52
|
+
expect(page).to have_content "bravo"
|
53
|
+
expect(page).to have_content "こんにちは!こんにちは!"
|
54
|
+
expect(page).to have_content "こんばんは!こんばんは!"
|
55
55
|
}
|
56
56
|
|
57
57
|
today = Date.today.strftime('%Y年%m月%d日')
|
58
58
|
page.find('h2', text: today).click_link today
|
59
59
|
within('div.day div.comment div.commentbody') {
|
60
60
|
t = Time.now
|
61
|
-
page.
|
62
|
-
page.
|
63
|
-
page.
|
64
|
-
page.
|
65
|
-
page.
|
61
|
+
expect(page).to have_content "%04d年%02d月%02d日" % [t.year, t.month, t.day]
|
62
|
+
expect(page).to have_content "alpha"
|
63
|
+
expect(page).to have_content "bravo"
|
64
|
+
expect(page).to have_content "こんにちは!こんにちは!"
|
65
|
+
expect(page).to have_content "こんばんは!こんばんは!"
|
66
66
|
}
|
67
67
|
end
|
68
68
|
|
@@ -76,11 +76,11 @@ BODY
|
|
76
76
|
BODY
|
77
77
|
|
78
78
|
click_button '投稿'
|
79
|
-
page.
|
79
|
+
expect(page).to have_content "Click here!"
|
80
80
|
|
81
81
|
visit "/"
|
82
82
|
within('ol.recent-comment > li') do
|
83
|
-
page.
|
83
|
+
expect(page).to have_content "alpha"
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
@@ -5,29 +5,29 @@ feature '日記の追記' do
|
|
5
5
|
scenario '更新画面のデフォルト表示' do
|
6
6
|
visit '/'
|
7
7
|
click_link '追記'
|
8
|
-
page.
|
8
|
+
expect(page).to have_content('日記の更新')
|
9
9
|
|
10
10
|
y, m, d = Date.today.to_s.split('-').map {|t| t.sub(/^0+/, "") }
|
11
|
-
within('span.year') { page.
|
12
|
-
within('span.month') { page.
|
13
|
-
within('span.day') { page.
|
11
|
+
within('span.year') { expect(page).to have_field('year', with: y) }
|
12
|
+
within('span.month') { expect(page).to have_field('month', with: m) }
|
13
|
+
within('span.day') { expect(page).to have_field('day', with: d) }
|
14
14
|
end
|
15
15
|
|
16
16
|
scenario '今日の日記を書く' do
|
17
17
|
append_default_diary
|
18
18
|
|
19
19
|
visit '/'
|
20
|
-
within('div.day span.title'){ page.
|
20
|
+
within('div.day span.title'){ expect(page).to have_content "tDiaryのテスト" }
|
21
21
|
within('div.day div.section'){
|
22
|
-
within('h3') { page.
|
23
|
-
page.
|
22
|
+
within('h3') { expect(page).to have_content "さて、テストである。" }
|
23
|
+
expect(page).to have_content "とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P"
|
24
24
|
}
|
25
25
|
today = Date.today.strftime('%Y年%m月%d日')
|
26
26
|
page.find('h2', text: today).click_link today
|
27
|
-
within('div.day span.title'){ page.
|
27
|
+
within('div.day span.title'){ expect(page).to have_content "tDiaryのテスト" }
|
28
28
|
within('div.day div.section'){
|
29
|
-
within('h3') { page.
|
30
|
-
page.
|
29
|
+
within('h3') { expect(page).to have_content "さて、テストである。" }
|
30
|
+
expect(page).to have_content "とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P"
|
31
31
|
}
|
32
32
|
end
|
33
33
|
|
@@ -36,10 +36,10 @@ feature '日記の追記' do
|
|
36
36
|
|
37
37
|
visit '/'
|
38
38
|
page.find('h2', text: '2001年04月23日').click_link '2001年04月23日'
|
39
|
-
within('div.day span.title'){ page.
|
39
|
+
within('div.day span.title'){ expect(page).to have_content "tDiaryのテスト" }
|
40
40
|
within('div.day div.section'){
|
41
|
-
within('h3') { page.
|
42
|
-
page.
|
41
|
+
within('h3') { expect(page).to have_content "さて、テストである。" }
|
42
|
+
expect(page).to have_content "とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P"
|
43
43
|
}
|
44
44
|
end
|
45
45
|
|
@@ -57,15 +57,15 @@ BODY
|
|
57
57
|
}
|
58
58
|
|
59
59
|
click_button "追記"
|
60
|
-
page.
|
60
|
+
expect(page).to have_content "Click here!"
|
61
61
|
|
62
62
|
visit '/'
|
63
|
-
within('div.day span.title'){ page.
|
63
|
+
within('div.day span.title'){ expect(page).to have_content "Hikiのテスト" }
|
64
64
|
within('div.body'){
|
65
|
-
page.
|
66
|
-
page.
|
67
|
-
page.
|
68
|
-
page.
|
65
|
+
expect(page).to have_content "さて、テストである。"
|
66
|
+
expect(page).to have_content "とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P"
|
67
|
+
expect(page).to have_content "さて、Hikiのテストである。"
|
68
|
+
expect(page).to have_content "とみせかけてtDiary:-)"
|
69
69
|
}
|
70
70
|
end
|
71
71
|
|
@@ -81,10 +81,10 @@ BODY
|
|
81
81
|
}
|
82
82
|
|
83
83
|
click_button 'プレビュー'
|
84
|
-
page.
|
84
|
+
expect(page).to have_content "tDiaryのテスト"
|
85
85
|
within('div.day div.section'){
|
86
|
-
within('h3') { page.
|
87
|
-
page.
|
86
|
+
within('h3') { expect(page).to have_content "さて、テストである。" }
|
87
|
+
expect(page).to have_content "とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P"
|
88
88
|
}
|
89
89
|
end
|
90
90
|
end
|
@@ -14,9 +14,9 @@ feature 'ツッコミ設定の利用' do
|
|
14
14
|
|
15
15
|
click_link '最新'
|
16
16
|
within('div.day div.comment') {
|
17
|
-
page.
|
18
|
-
page.
|
19
|
-
page.
|
17
|
+
expect(page).to have_no_css('div[class="commentshort"]')
|
18
|
+
expect(page).to have_no_content "alpha"
|
19
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
20
20
|
}
|
21
21
|
end
|
22
22
|
|
@@ -32,7 +32,7 @@ feature 'ツッコミ設定の利用' do
|
|
32
32
|
BODY
|
33
33
|
|
34
34
|
click_button '投稿'
|
35
|
-
page.
|
35
|
+
expect(page).to have_content "Click here!"
|
36
36
|
|
37
37
|
visit '/update.rb?conf=comment'
|
38
38
|
fill_in 'comment_limit', with: '1'
|
@@ -42,19 +42,19 @@ BODY
|
|
42
42
|
|
43
43
|
click_link '最新'
|
44
44
|
within('div.day div.comment div.commentshort') {
|
45
|
-
page.
|
46
|
-
page.
|
47
|
-
page.
|
48
|
-
page.
|
45
|
+
expect(page).to have_no_content "alpha"
|
46
|
+
expect(page).to have_content "bravo"
|
47
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
48
|
+
expect(page).to have_content "こんばんは!こんばんは!"
|
49
49
|
}
|
50
50
|
|
51
51
|
today = Date.today.strftime('%Y年%m月%d日')
|
52
52
|
page.find('h2', text: today).click_link today
|
53
|
-
within('div.day div.comment div.commentbody') {
|
54
|
-
page.
|
55
|
-
page.
|
56
|
-
page.
|
57
|
-
page.
|
53
|
+
within('div.day div.comment div.commentbody') {
|
54
|
+
expect(page).to have_content "alpha"
|
55
|
+
expect(page).to have_content "bravo"
|
56
|
+
expect(page).to have_content "こんにちは!こんにちは!"
|
57
|
+
expect(page).to have_content "こんばんは!こんばんは!"
|
58
58
|
}
|
59
59
|
end
|
60
60
|
|
@@ -72,8 +72,8 @@ BODY
|
|
72
72
|
today = Date.today.strftime('%Y年%m月%d日')
|
73
73
|
page.find('h2', text: today).click_link today
|
74
74
|
within('div#comment-form-section') {
|
75
|
-
within('div.caption') { page.
|
76
|
-
page.
|
75
|
+
within('div.caption') { expect(page).to have_content('本日の日記はツッコミ数の制限を越えています。') }
|
76
|
+
expect(page).to have_no_css('form')
|
77
77
|
}
|
78
78
|
end
|
79
79
|
end
|
@@ -22,12 +22,12 @@ feature '基本設定の利用' do
|
|
22
22
|
# within('title') { page.should have_content('ただの日記') }
|
23
23
|
|
24
24
|
visit '/update.rb?conf=default'
|
25
|
-
page.
|
26
|
-
page.
|
27
|
-
page.
|
28
|
-
page.
|
29
|
-
page.
|
30
|
-
page.
|
25
|
+
expect(page).to have_field "author_name", with: "ただただし"
|
26
|
+
expect(page).to have_field "html_title", with: "ただの日記"
|
27
|
+
expect(page).to have_field "author_mail", with: "t@tdtds.jp"
|
28
|
+
expect(page).to have_field "index_page", with: "http://www.example.com"
|
29
|
+
expect(page).to have_field "description", with: "ただただしによる日々の記録"
|
30
|
+
expect(page).to have_field "icon", with: "http://tdtds.jp/favicon.png"
|
31
31
|
# TODO banner の値が fill_in されない
|
32
32
|
# page.should have_field("banner", with: "http://sho.tdiary.net/images/banner.png")
|
33
33
|
end
|
@@ -49,16 +49,16 @@ FOOTER
|
|
49
49
|
#within('title') { page.should have_content('(設定完了)') }
|
50
50
|
|
51
51
|
click_link '最新'
|
52
|
-
within('h1') { page.
|
53
|
-
within('div.sidebar') { page.
|
52
|
+
within('h1') { expect(page).to have_content('alpha') }
|
53
|
+
within('div.sidebar') { expect(page).to have_content('bravo')}
|
54
54
|
|
55
55
|
visit '/update.rb?conf=header'
|
56
|
-
page.
|
56
|
+
expect(page).to have_field "header", with: <<-HEADER
|
57
57
|
<%= navi %>
|
58
58
|
<h1>alpha</h1>
|
59
59
|
<div class="main">
|
60
60
|
HEADER
|
61
|
-
page.
|
61
|
+
expect(page).to have_field "footer", with: <<-FOOTER
|
62
62
|
</div>
|
63
63
|
<div class="sidebar">
|
64
64
|
bravo
|
@@ -85,12 +85,12 @@ FOOTER
|
|
85
85
|
# within('title') { page.should have_content('(設定完了)') }
|
86
86
|
|
87
87
|
click_link '最新'
|
88
|
-
page.
|
89
|
-
page.
|
88
|
+
expect(page).to have_content('★')
|
89
|
+
expect(page).to have_content('●')
|
90
90
|
titles = page.all('h2 span.date a').map{|t| t.text }
|
91
|
-
titles.
|
92
|
-
titles.
|
93
|
-
page.
|
91
|
+
expect(titles).to include("#{today.year}:#{'%02d' % today.month}:#{'%02d' % today.day}")
|
92
|
+
expect(titles).not_to include("#{yestarday.year}:#{'%02d' % yestarday.month}:#{'%02d' % yestarday.day}")
|
93
|
+
expect(page).not_to have_content("長年日記")
|
94
94
|
end
|
95
95
|
|
96
96
|
scenario 'ログレベルの選択の設定' do
|
@@ -104,7 +104,7 @@ FOOTER
|
|
104
104
|
# TODO ログレベルの確認
|
105
105
|
|
106
106
|
visit '/update.rb?conf=logger'
|
107
|
-
within('select option[selected]'){ page.
|
107
|
+
within('select option[selected]'){ expect(page).to have_content 'DEBUG' }
|
108
108
|
end
|
109
109
|
|
110
110
|
scenario '時差調整が保存される' do
|
@@ -116,13 +116,13 @@ FOOTER
|
|
116
116
|
|
117
117
|
click_link '追記'
|
118
118
|
y, m, d = (Date.today - 1).to_s.split('-').map {|t| t.sub(/^0+/, "") }
|
119
|
-
within('span.year') { page.
|
120
|
-
within('span.month') { page.
|
121
|
-
within('span.day') { page.
|
119
|
+
within('span.year') { expect(page).to have_field('year', with: y) }
|
120
|
+
within('span.month') { expect(page).to have_field('month', with: m) }
|
121
|
+
within('span.day') { expect(page).to have_field('day', with: d) }
|
122
122
|
|
123
123
|
click_link '設定'
|
124
124
|
click_link '時差調整'
|
125
|
-
page.
|
125
|
+
expect(page).to have_field('hour_offset', with: '-24.0')
|
126
126
|
end
|
127
127
|
|
128
128
|
scenario 'Rack 環境でテーマ選択が保存される', :exclude_selenium do
|
@@ -132,12 +132,12 @@ FOOTER
|
|
132
132
|
page.all('div.saveconf').first.click_button "OK"
|
133
133
|
|
134
134
|
click_link '最新'
|
135
|
-
page.body.
|
136
|
-
page.body.
|
135
|
+
expect(page.body).to be_include('href="assets/base.css"')
|
136
|
+
expect(page.body).to be_include('href="assets/tdiary1/tdiary1.css"')
|
137
137
|
|
138
138
|
visit '/update.rb?conf=theme'
|
139
139
|
within('select option[selected]'){
|
140
|
-
page.
|
140
|
+
expect(page).to have_content 'Tdiary1'
|
141
141
|
}
|
142
142
|
end
|
143
143
|
|
@@ -149,13 +149,13 @@ FOOTER
|
|
149
149
|
|
150
150
|
click_link '最新'
|
151
151
|
within('head') {
|
152
|
-
page.
|
153
|
-
page.
|
152
|
+
expect(page).to have_css('link[href="theme/base.css"]')
|
153
|
+
expect(page).to have_css('link[href="theme/tdiary1/tdiary1.css"]')
|
154
154
|
}
|
155
155
|
|
156
156
|
visit '/update.rb?conf=theme'
|
157
157
|
within('select option[selected]'){
|
158
|
-
page.
|
158
|
+
expect(page).to have_content 'Tdiary1'
|
159
159
|
}
|
160
160
|
end
|
161
161
|
end
|
@@ -11,13 +11,13 @@ feature 'spamフィルタ設定の利用', :exclude_selenium do
|
|
11
11
|
page.all('div.saveconf').first.click_button 'OK'
|
12
12
|
|
13
13
|
visit '/update.rb?conf=dnsblfilter'
|
14
|
-
page.
|
15
|
-
page.
|
14
|
+
expect(page).to have_no_content "dnsbl.spam-champuru.livedoor.com"
|
15
|
+
expect(page).to have_content "bsb.spamlookup.net"
|
16
16
|
end
|
17
17
|
|
18
18
|
scenario 'IPベースのブラックリストが動作する' do
|
19
|
-
IPSocket.
|
20
|
-
Resolv.
|
19
|
+
allow(IPSocket).to receive(:getaddress) { '127.0.0.1' }
|
20
|
+
allow(Resolv).to receive(:getaddress) { '127.0.0.1' }
|
21
21
|
|
22
22
|
append_default_diary
|
23
23
|
|
@@ -37,12 +37,12 @@ BODY
|
|
37
37
|
click_button '投稿'
|
38
38
|
|
39
39
|
visit "/"
|
40
|
-
page.
|
41
|
-
page.
|
40
|
+
expect(page).to have_no_content "alpha"
|
41
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
42
42
|
end
|
43
43
|
|
44
44
|
scenario 'IPベースのブラックリストでセーフの場合' do
|
45
|
-
IPSocket.
|
45
|
+
allow(IPSocket).to receive(:getaddress) { raise TimeoutError }
|
46
46
|
|
47
47
|
append_default_diary
|
48
48
|
|
@@ -62,12 +62,12 @@ BODY
|
|
62
62
|
click_button '投稿'
|
63
63
|
|
64
64
|
visit "/"
|
65
|
-
page.
|
66
|
-
page.
|
65
|
+
expect(page).to have_content "alpha"
|
66
|
+
expect(page).to have_content "こんにちは!こんにちは!"
|
67
67
|
end
|
68
68
|
|
69
69
|
scenario 'ドメインベースのブラックリストが動作する' do
|
70
|
-
Resolv.
|
70
|
+
allow(Resolv).to receive(:getaddress) { '127.0.0.1' }
|
71
71
|
|
72
72
|
append_default_diary
|
73
73
|
|
@@ -87,12 +87,12 @@ BODY
|
|
87
87
|
click_button '投稿'
|
88
88
|
|
89
89
|
visit "/"
|
90
|
-
page.
|
91
|
-
page.
|
90
|
+
expect(page).to have_no_content "alpha"
|
91
|
+
expect(page).to have_no_content "こんにちは!こんにちは!"
|
92
92
|
end
|
93
93
|
|
94
94
|
scenario 'ドメインベースのブラックリストでセーフの場合' do
|
95
|
-
Resolv.
|
95
|
+
allow(Resolv).to receive(:getaddress) { raise TimeoutError }
|
96
96
|
|
97
97
|
append_default_diary
|
98
98
|
|
@@ -112,13 +112,13 @@ BODY
|
|
112
112
|
click_button '投稿'
|
113
113
|
|
114
114
|
visit "/"
|
115
|
-
page.
|
116
|
-
page.
|
115
|
+
expect(page).to have_content "alpha"
|
116
|
+
expect(page).to have_content "こんにちは!こんにちは!"
|
117
117
|
end
|
118
118
|
|
119
119
|
scenario 'ブラックリストに問い合わせないリストが動作する' do
|
120
|
-
IPSocket.
|
121
|
-
Resolv.
|
120
|
+
expect(IPSocket).to receive(:getaddress).exactly(0)
|
121
|
+
expect(Resolv).to receive(:getaddress).exactly(0)
|
122
122
|
|
123
123
|
append_default_diary
|
124
124
|
|
@@ -138,8 +138,8 @@ BODY
|
|
138
138
|
click_button '投稿'
|
139
139
|
|
140
140
|
visit "/"
|
141
|
-
page.
|
142
|
-
page.
|
141
|
+
expect(page).to have_content "alpha"
|
142
|
+
expect(page).to have_content "こんにちは!こんにちは!"
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|