0

I was trying to test my response.body with regex, to make up for shifts in time zones due to daylight saving. For that I wrote following assert:

assert_match(/data-timer-timezone-value=\\"-[7|8]\\"/, response.body)

The tests fails, and gives me following result (not full response.body shown, due to size):

Expected /data-timer-timezone-value=\\"-[7|8]\\"/ to match
<h1 class=\"text-center\">Tracky</h1>\n    
<div class=\"w-100 mt-3\" data-timer-session-container>\n      
   <div class=\"box\" data-controller=\"form timer\" data-timer-timezone-value=\"-7\">\n  
      <div class=\"timer-container\">\n    
         <form class=\"new_timer_session\" id=\"new_timer_session\" action=\"/time_tracker/start\" accept-charset=\"UTF-8\" data-remote=\"true\" name=\"new_timer_session-604fb9d8\" method=\"post\">

You can see, that there should be a match on line 3 of the html. Even regex101 tells me, it should work: https://regex101.com/r/LdiBlY/1

Anes
  • 315
  • 1
  • 9

0 Answers0