Skip to content

Commit

Permalink
各ページのシステムテストを移行
Browse files Browse the repository at this point in the history
  • Loading branch information
mono-nobe committed Mar 26, 2023
1 parent aa69d00 commit 6eef41e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

require 'application_system_test_case'

class Admin::CategoriesTest < ApplicationSystemTestCase
class Mentor::CategoriesTest < ApplicationSystemTestCase
test 'show listing categories' do
visit_with_auth '/admin/categories', 'komagata'
assert_equal '管理ページ | FBC', title
visit_with_auth '/mentor/categories', 'mentormentaro'
assert_equal 'メンターページ | FBC', title
end

test 'show category page' do
visit_with_auth admin_category_path(categories(:category2)), 'komagata'
visit_with_auth mentor_category_path(categories(:category2)), 'mentormentaro'
assert_equal 'Mac OS X | FBC', title
first('.card-list-item').assert_text 'OS X Mountain Lionをクリーンインストールする'
end

test 'create category' do
visit_with_auth '/admin/categories/new', 'komagata'
visit_with_auth '/mentor/categories/new', 'mentormentaro'
within 'form[name=category]' do
fill_in 'category[name]', with: 'テストカテゴリー'
fill_in 'category[slug]', with: 'test-category'
Expand All @@ -26,7 +26,7 @@ class Admin::CategoriesTest < ApplicationSystemTestCase
end

test 'update category from course page' do
visit_with_auth course_practices_path(courses(:course1)), 'komagata'
visit_with_auth course_practices_path(courses(:course1)), 'mentormentaro'
first('.categories-item__edit').click
within 'form[name=category]' do
fill_in 'category[name]', with: 'テストカテゴリー'
Expand All @@ -38,8 +38,8 @@ class Admin::CategoriesTest < ApplicationSystemTestCase
assert_current_path course_practices_path(courses(:course1))
end

test 'update category from admin categories' do
visit_with_auth admin_categories_path, 'komagata'
test 'update category from mentor categories' do
visit_with_auth mentor_categories_path, 'mentormentaro'
first('.spec-edit').click
within 'form[name=category]' do
fill_in 'category[name]', with: 'テストカテゴリー'
Expand All @@ -48,11 +48,11 @@ class Admin::CategoriesTest < ApplicationSystemTestCase
click_button '更新する'
end
assert_text 'カテゴリーを更新しました。'
assert_current_path admin_categories_path
assert_current_path mentor_categories_path
end

test 'delete category' do
visit_with_auth "/admin/categories/#{categories(:category1).id}/edit", 'komagata'
visit_with_auth "/mentor/categories/#{categories(:category1).id}/edit", 'mentormentaro'
click_on '削除'
page.driver.browser.switch_to.alert.accept
assert_text 'カテゴリーを削除しました。'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

require 'application_system_test_case'

class Admin::CoursesTest < ApplicationSystemTestCase
class Mentor::CoursesTest < ApplicationSystemTestCase
test 'show listing courses' do
visit_with_auth '/admin/courses', 'komagata'
assert_equal '管理ページ | FBC', title
visit_with_auth '/mentor/courses', 'mentormentaro'
assert_equal 'メンターページ | FBC', title
end

test 'create course' do
visit_with_auth '/admin/courses/new', 'komagata'
visit_with_auth '/mentor/courses/new', 'mentormentaro'
within 'form[name=course]' do
fill_in 'course[title]', with: 'テストコース'
fill_in 'course[description]', with: 'テストのコースです。'
Expand All @@ -19,7 +19,7 @@ class Admin::CoursesTest < ApplicationSystemTestCase
end

test 'update course' do
visit_with_auth "/admin/courses/#{courses(:course1).id}/edit", 'komagata'
visit_with_auth "/mentor/courses/#{courses(:course1).id}/edit", 'mentormentaro'
within 'form[name=course]' do
fill_in 'course[title]', with: 'テストコース'
fill_in 'course[description]', with: 'テストのコースです。'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

require 'application_system_test_case'

class Admin::PracticesTest < ApplicationSystemTestCase
class Mentor::PracticesTest < ApplicationSystemTestCase
test 'show listing practices' do
visit_with_auth admin_practices_path, 'komagata'
assert_equal '管理ページ | FBC', title
visit_with_auth mentor_practices_path, 'mentormentaro'
assert_equal 'メンターページ | FBC', title
end

test 'show practice page' do
visit_with_auth admin_practices_path, 'komagata'
visit_with_auth mentor_practices_path, 'mentormentaro'
first('.admin-table__item').assert_text 'sshdでパスワード認証を禁止にする'
end
end

0 comments on commit 6eef41e

Please sign in to comment.