[RUBY] [Integration test code] How to select an element from date_select

I wrote a simple integration test code and was addicted to it, so I will leave it as a memorandum. I would appreciate it if you could point out any mistakes.

<%= raw sprintf(
    form.date_select(
      :birthday,
      class:'select-birth',
      id:"birth-date",
      use_month_numbers: true,
      prompt:'--',
      start_year: 1930,
      end_year: (Time.now.year - 5),
      date_separator: '%s'),

"

Year </ p>", "

Month </ p>") + "

Day </ p>"%>

I was worried because I couldn't select the elements as I wanted in the form for selecting the year, month, and day, but the following article was helpful.

Introduction to RSpec that can be used, part 4 "Any browser operation is free! Reverse lookup Capybara dictionary"

In conclusion, when I verified with a browser and checked the element I wanted to specify, the name attribute was properly assigned one by one, so describe it as it is

select '1930',from: 'dear_person[birthday(1i)]'
  select '12',from: 'dear_person[birthday(2i)]'
  select '12',from: 'dear_person[birthday(3i)]'

I passed here safely. It's completely my mistake.

Recommended Posts

[Integration test code] How to select an element from date_select
[RSpec] How to write test code
How to call Swift 5.3 code from Objective-C
How to write an RSpec controller test
How to use "sign_in" in integration test (RSpec)
How to get Class from Element in Java
How to write test code with Basic authentication
How to output standard from an array with forEach
[Ruby] How to extract a specific value from an array under multiple conditions [select / each]
How to create an application
How to write good code
[iOS] [Objective-C] How to update a widget from an Objective-C app
How to create a form to select a date from the calendar
How to select a specified date by code in FSCalendar
[Rails] Integration test using Capybara (from introduction to simple test execution)
How to handle an instance
How to migrate from JUnit4 to JUnit5
How to apply C code format from the command line
[RSpec on Rails] How to write test code for beginners by beginners
How to build an Apache Flink application from scratch in 5 minutes
How to open a script file from Ubuntu with VS code
I tested how to use Ruby's test / unit and rock-paper-scissors code.
How to unit test Spring AOP
How to insert an external library
How to write easy-to-understand code [Summary 3]
How to change from HTML to Haml
[Swift] Summary of how to remove elements from an array (personal note)
How to set different source / target versions for production code and test code
[Rspec] Flow from introducing Rspec to writing unit test code for a model
How to crop an image with libGDX
[Rails] How to convert from erb to haml
How to filter JUnit Test in Gradle
How to blur an image (super easy)
How to publish an application on Heroku
[Flutter] How to use C / C ++ from Dart?
How to define an inner class bean
Java: How to send values from Servlet to Servlet
[Java] Flow from source code to execution
[SpringBoot] How to write a controller test
How to count UTF-8 code points fast
[iOS] How to make UI parts added from code fit in Safe Area
[Java] How to convert one element of a String type array to an Int type
[swift5] How to transition from the app to an external site by specifying the URL
How to get an arbitrary digit from a number of 2 or more digits! !!
How to start a subscript from an arbitrary number in Ruby iterative processing
From creating a Spring Boot project to running an application with VS Code