Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit

Permalink
accept capybara-2.0.0 ways
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Nov 17, 2012
1 parent a43f1ca commit 1ddb59f
Show file tree
Hide file tree
Showing 15 changed files with 165 additions and 134 deletions.
9 changes: 5 additions & 4 deletions spec/acceptance/append_comment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
}
page.should have_content "こんにちは!こんにちは!"
}

click_link "#{Date.today.strftime('%Y年%m月%d日')}"
today = Date.today.strftime('%Y年%m月%d日')
page.find('h2', :text => today).click_link today
within('div.day div.comment div.commentbody') {
within('div.commentator'){
t = Time.now
Expand Down Expand Up @@ -54,10 +54,11 @@
page.should have_content "こんばんは!こんばんは!"
}

click_link "#{Date.today.strftime('%Y年%m月%d日')}"
today = Date.today.strftime('%Y年%m月%d日')
page.find('h2', :text => today).click_link today
within('div.day div.comment div.commentbody') {
t = Time.now
within('span.commenttime'){ page.should have_content "%04d年%02d月%02d日" % [t.year, t.month, t.day] }
page.should have_content "%04d年%02d月%02d日" % [t.year, t.month, t.day]
page.should have_content "alpha"
page.should have_content "bravo"
page.should have_content "こんにちは!こんにちは!"
Expand Down
40 changes: 21 additions & 19 deletions spec/acceptance/append_diary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
page.should have_content('日記の更新')

y, m, d = Date.today.to_s.split('-').map {|t| t.sub(/^0+/, "") }
within('div.day div.form') {
within('span.year') { page.should have_field('year', :with => y) }
within('span.month') { page.should have_field('month', :with => m) }
within('span.day') { page.should have_field('day', :with => d) }
}
within('span.year') { page.should have_field('year', :with => y) }
within('span.month') { page.should have_field('month', :with => m) }
within('span.day') { page.should have_field('day', :with => d) }
end

scenario '今日の日記を書く' do
Expand All @@ -24,8 +22,8 @@
within('h3') { page.should have_content "さて、テストである。" }
page.should have_content "とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P"
}

click_link "#{Date.today.strftime('%Y年%m月%d日')}"
today = Date.today.strftime('%Y年%m月%d日')
page.find('h2', :text => today).click_link today
within('div.day span.title'){ page.should have_content "tDiaryのテスト" }
within('div.day div.section'){
within('h3') { page.should have_content "さて、テストである。" }
Expand All @@ -37,7 +35,7 @@
append_default_diary('2001-04-23')

visit '/'
click_link "#{Date.parse('20010423').strftime('%Y年%m月%d日')}"
page.find('h2', :text => '2001年04月23日').click_link '2001年04月23日'
within('div.day span.title'){ page.should have_content "tDiaryのテスト" }
within('div.day div.section'){
within('h3') { page.should have_content "さて、テストである。" }
Expand All @@ -50,14 +48,12 @@

visit '/'
click_link '追記'
within('div.day div.form') {
within('div.title') { fill_in "title", :with => "Hikiのテスト" }
within('div.textarea') {
fill_in "body", :with => <<-BODY
within('div.title') { fill_in "title", :with => "Hikiのテスト" }
within('div.textarea') {
fill_in "body", :with => <<-BODY
!さて、Hikiのテストである。
とみせかけてtDiary:-)
BODY
}
}

click_button "追記"
Expand All @@ -76,21 +72,27 @@
scenario '日記のプレビュー' do
visit '/'
click_link '追記'
within('div.day div.form') {
within('div.title') { fill_in "title", :with => "tDiaryのテスト" }
within('div.textarea') {
fill_in "body", :with => <<-BODY
within('div.title') { fill_in "title", :with => "tDiaryのテスト" }
within('div.textarea') {
fill_in "body", :with => <<-BODY
!さて、テストである。
とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P
BODY
}
}

click_button 'プレビュー'
within('div.day span.title'){ page.should have_content "tDiaryのテスト" }
page.should have_content "tDiaryのテスト"
within('div.day div.section'){
within('h3') { page.should have_content "さて、テストである。" }
page.should have_content "とりあえず自前の環境ではちゃんと動いているが、きっと穴がいっぱいあるに違いない:-P"
}
end
end

# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:
# vim: ts=3
18 changes: 10 additions & 8 deletions spec/acceptance/save_conf_comment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
visit '/update.rb?conf=comment'
select '非表示', :from => 'show_comment'

click_button "OK"
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button "OK"
# within('title') { page.should have_content('(設定完了)') }

click_link '最新'
within('div.day div.comment') {
Expand All @@ -37,8 +37,8 @@
visit '/update.rb?conf=comment'
fill_in 'comment_limit', :with => '1'

click_button "OK"
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button "OK"
# within('title') { page.should have_content('(設定完了)') }

click_link '最新'
within('div.day div.comment div.commentshort') {
Expand All @@ -48,7 +48,8 @@
page.should have_content "こんばんは!こんばんは!"
}

click_link "#{Date.today.strftime('%Y年%m月%d日')}"
today = Date.today.strftime('%Y年%m月%d日')
page.find('h2', :text => today).click_link today
within('div.day div.comment div.commentbody') {
page.should have_content "alpha"
page.should have_content "bravo"
Expand All @@ -64,11 +65,12 @@
visit '/update.rb?conf=comment'
fill_in 'comment_limit_per_day', :with => '1'

click_button "OK"
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button "OK"
# within('title') { page.should have_content('(設定完了)') }

click_link '最新'
click_link "#{Date.today.strftime('%Y年%m月%d日')}"
today = Date.today.strftime('%Y年%m月%d日')
page.find('h2', :text => today).click_link today
within('div#comment-form-section') {
within('div.caption') { page.should have_content('本日の日記はツッコミ数の制限を越えています。') }
page.should have_no_css('form')
Expand Down
38 changes: 18 additions & 20 deletions spec/acceptance/save_conf_default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
#fill_in "banner", :with => "http://sho.tdiary.net/images/banner.png"
# TODO x_frame_open の設定

click_button "OK"
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button "OK"
# within('title') { page.should have_content('(設定完了)') }

click_link '最新'
# TODO その他の項目の反映を確認
within('title') { page.should have_content('ただの日記') }
# within('title') { page.should have_content('ただの日記') }

visit '/update.rb?conf=default'
page.should have_field "author_name", :with => "ただただし"
Expand All @@ -45,8 +45,8 @@
bravo
</div>
FOOTER
click_button "OK"
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button "OK"
#within('title') { page.should have_content('(設定完了)') }

click_link '最新'
within('h1') { page.should have_content('alpha') }
Expand Down Expand Up @@ -81,8 +81,8 @@
fill_in 'latest_limit', :with => 1
select '非表示', :from => 'show_nyear'

click_button "OK"
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button "OK"
# within('title') { page.should have_content('(設定完了)') }

click_link '最新'
page.should have_content('★')
Expand All @@ -97,8 +97,8 @@
visit '/update.rb?conf=logger'
select 'DEBUG', :from => 'log_level'

click_button "OK"
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button "OK"
# within('title') { page.should have_content('(設定完了)') }

click_link '最新'
# TODO ログレベルの確認
Expand All @@ -111,16 +111,14 @@
visit '/update.rb?conf=timezone'
fill_in 'hour_offset', :with => '-24'

click_button "OK"
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button "OK"
# within('title') { page.should have_content('(設定完了)') }

click_link '追記'
y, m, d = (Date.today - 1).to_s.split('-').map {|t| t.sub(/^0+/, "") }
within('div.day div.form') {
within('span.year') { page.should have_field('year', :with => y) }
within('span.month') { page.should have_field('month', :with => m) }
within('span.day') { page.should have_field('day', :with => d) }
}
within('span.year') { page.should have_field('year', :with => y) }
within('span.month') { page.should have_field('month', :with => m) }
within('span.day') { page.should have_field('day', :with => d) }

click_link '設定'
click_link '時差調整'
Expand All @@ -131,8 +129,8 @@
visit '/update.rb?conf=theme'
select 'Tdiary1', :from => 'theme'

click_button "OK"
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button "OK"
# within('title') { page.should have_content('(設定完了)') }

click_link '最新'
within('head') {
Expand All @@ -150,8 +148,8 @@
visit '/update.rb?conf=theme'
select 'Tdiary1', :from => 'theme'

click_button "OK"
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button "OK"
# within('title') { page.should have_content('(設定完了)') }

click_link '最新'
within('head') {
Expand Down
10 changes: 5 additions & 5 deletions spec/acceptance/save_conf_dnsbl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
fill_in 'spamlookup.ip.list', :with => "dnsbl.spam-champuru.livedoor.com"
fill_in 'spamlookup.domain.list', :with => ""
fill_in 'spamlookup.safe_domain.list', :with => ""
click_button 'OK'
page.all('div.saveconf').first.click_button 'OK'

visit "/"
click_link 'ツッコミを入れる'
Expand All @@ -38,7 +38,7 @@
fill_in 'spamlookup.ip.list', :with => "dnsbl.spam-champuru.livedoor.com"
fill_in 'spamlookup.domain.list', :with => ""
fill_in 'spamlookup.safe_domain.list', :with => ""
click_button 'OK'
page.all('div.saveconf').first.click_button 'OK'

visit "/"
click_link 'ツッコミを入れる'
Expand All @@ -63,7 +63,7 @@
fill_in 'spamlookup.ip.list', :with => ""
fill_in 'spamlookup.domain.list', :with => "bsb.spamlookup.net"
fill_in 'spamlookup.safe_domain.list', :with => ""
click_button 'OK'
page.all('div.saveconf').first.click_button 'OK'

visit "/"
click_link 'ツッコミを入れる'
Expand All @@ -88,7 +88,7 @@
fill_in 'spamlookup.ip.list', :with => ""
fill_in 'spamlookup.domain.list', :with => "bsb.spamlookup.net"
fill_in 'spamlookup.safe_domain.list', :with => ""
click_button 'OK'
page.all('div.saveconf').first.click_button 'OK'

visit "/"
click_link 'ツッコミを入れる'
Expand All @@ -114,7 +114,7 @@
fill_in 'spamlookup.ip.list', :with => "dnsbl.spam-champuru.livedoor.com"
fill_in 'spamlookup.domain.list', :with => "bsb.spamlookup.net"
fill_in 'spamlookup.safe_domain.list', :with => "www.example.com"
click_button 'OK'
page.all('div.saveconf').first.click_button 'OK'

visit "/"
click_link 'ツッコミを入れる'
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/save_conf_filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
scenario '新入荷のプラグインが表示される' do
visit '/update.rb?conf=sf'

click_button 'OK'
page.all('div.saveconf').first.click_button 'OK'
page.should_not have_content '新入荷'

FileUtils.cp_r "#{TDiary::PATH}/spec/fixtures/sample.rb", "#{TDiary::PATH}/misc/filter/"
Expand All @@ -22,7 +22,7 @@

visit '/update.rb?conf=sf'
check "sf.sample.rb"
click_button 'OK'
page.all('div.saveconf').first.click_button 'OK'

page.should have_checked_field "sf.sample.rb"

Expand Down
6 changes: 3 additions & 3 deletions spec/acceptance/save_conf_plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
FileUtils.rm plugin_path if File.exists? plugin_path

visit '/update.rb?conf=sp'
click_button 'OK'
page.all('div.saveconf').first.click_button 'OK'
page.should_not have_content '新入荷'

FileUtils.touch plugin_path
Expand All @@ -26,7 +26,7 @@
visit '/update.rb?conf=sp'

check "sp.rspec.rb"
click_button 'OK'
page.all('div.saveconf').first.click_button 'OK'

page.should have_checked_field "sp.rspec.rb"

Expand All @@ -49,7 +49,7 @@
visit '/update.rb?conf=sp'

check "sp.category_autocomplete.rb"
click_button 'OK'
page.all('div.saveconf').first.click_button 'OK'

visit '/update.rb'

Expand Down
21 changes: 12 additions & 9 deletions spec/acceptance/save_conf_referer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
visit '/update.rb?conf=referer'
select('非表示', :from => 'show_referer')

click_button "OK"
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button "OK"
# within('title') { page.should have_content('(設定完了)') }

click_link '最新'
click_link "#{Date.today.strftime("%Y年%m月%d日")}"
today = Date.today.strftime("%Y年%m月%d日")
page.find('h2', :text => today).click_link today
within('div.day') { page.should have_no_css('div[class="refererlist"]') }
end

Expand All @@ -20,11 +21,12 @@
visit '/update.rb?conf=referer'
fill_in 'no_referer', :with => '^http://www\.example\.com/.*'

click_button('OK')
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button('OK')
# within('title') { page.should have_content('(設定完了)') }

click_link '最新'
click_link "#{Date.today.strftime('%Y年%m月%d日')}"
today = Date.today.strftime('%Y年%m月%d日')
page.find('h2', :text => today).click_link today
within('div.day div.refererlist') { page.should have_no_link('http://www.example.com') }
end

Expand All @@ -36,11 +38,12 @@
^http://www\.example\.net/.* bob
REFERER

click_button('OK')
within('title') { page.should have_content('(設定完了)') }
page.all('div.saveconf').first.click_button('OK')
# within('title') { page.should have_content('(設定完了)') }

click_link '最新'
click_link "#{Date.today.strftime('%Y年%m月%d日')}"
today = Date.today.strftime('%Y年%m月%d日')
page.find('h2', :text => today).click_link today
within('div.day div.refererlist') {
page.should have_link "alice"
page.should have_no_link "http://www.example.com"
Expand Down
Loading

0 comments on commit 1ddb59f

Please sign in to comment.