Skip to content

Commit

Permalink
モジュールのテストコードを作成する
Browse files Browse the repository at this point in the history
  • Loading branch information
yocchan-git committed Mar 28, 2024
1 parent 4414b5f commit c39dae5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/models/search_user_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require 'test_helper'

class SearchUserTest < ActiveSupport::TestCase
include SearchUser

test '検索文字が半角英文字2文字以下の時' do
assert_nil validate_search_word('ki')
end

test '検索文字が半角英文字3文字以上の時' do
assert_equal 'kim', validate_search_word('kim')
end

test '検索文字が全角英文字1文字以下の時' do
assert_nil validate_search_word('き')
end

test '検索文字が全角英文字2文字以下の時' do
assert_equal 'きむ', validate_search_word('きむ')
end

test '前後の空白は削除されること' do
assert_equal 'kim', validate_search_word(' kim ')
end
end

0 comments on commit c39dae5

Please sign in to comment.