Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Commit

Permalink
Merge pull request #33 from y-yagi/improve_test_coverage
Browse files Browse the repository at this point in the history
improve test coverage
  • Loading branch information
y-yagi committed Feb 13, 2015
2 parents 93feb89 + 0705304 commit 0452408
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
4 changes: 0 additions & 4 deletions app/decorators/travel_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
module TravelDecorator
def schedule
start_date.to_s + " ~ " + end_date.to_s
end

def formatted_schedule
I18n.l(start_date, format: :long) + " 〜 " + I18n.l(end_date, format: :long)
end
Expand Down
17 changes: 16 additions & 1 deletion test/integration/top_integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,29 @@ def setup
visit root_path
end

def login_with_facebook
first(:link, 'ログアウト').click
visit '/auth/facebook'
end

test 'display recently registered places in top page' do
assert_match '最近登録した場所', page.text
assert_match '大麻比古神社', page.text
assert_match '伏見稲荷大社', page.text
assert_no_match '上賀茂神社', page.text
end

test 'display next travel in top page' do
test 'display next travel in top page when there is plan of the travel' do
assert_match '次の旅行は京都旅行', page.text
end

test 'no plan of the travel' do
login_with_facebook
assert_match '旅行の予定はありません', page.text
end

test 'logout' do
first(:link, 'ログアウト').click
assert_match 'ログイン', page.text
end
end
6 changes: 6 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
'uid' => '1',
'provider' => 'google_oauth2',
)
OmniAuth.config.add_mock(:facebook,
'uid' => '2',
'provider' => 'facebook',
)


Minitest::Sound.success = '/home/yaginuma/Dropbox/tmp/music/other/sey.mp3'
Minitest::Sound.failure = '/home/yaginuma/Dropbox/tmp/music/other/mdai.mp3'
Expand All @@ -47,6 +52,7 @@ class ActionDispatch::IntegrationTest

require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist

def login
visit '/auth/google_oauth2'
end
Expand Down

0 comments on commit 0452408

Please sign in to comment.