0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Rspec Capybaraでdatetime_fieldを入力する方法

Last updated at Posted at 2023-09-16

plan新規作成のテスト中

ここにcapybaraで自動入力させたい
plan.index.erb
<%= f.datetime_field :start_time %>
これでは
plans_spec.rb
fill_in 'plan_start_time', with: '2023-01-01 12:00:00'
こんな感じでうまく入力されない

capybaraでのスクリーンショット
スクリーンショット 2023-09-16 12.29.24.png

ここでの質問を参考に

これに変更
plans_spec.rb
fill_in 'plan_start_time', with: "09202023\t0000a"

スクリーンショット 2023-09-16 12.27.56.png

入力されました
Plans_system
  Plan新規登録
    フォームの入力値が正常の場合
      Planの新規作成が成功し表とカレンダーのどちらにも表示されていること

Finished in 25.65 seconds (files took 14 seconds to load)
1 example, 0 failures
テストも通りました
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?