better-restaurant-41251
06/11/2024, 2:18 PMruby
Error:
PhoneNumberFieldTest#test_editing_a_phone_number_that_is_already_properly_formatted:
ActionView::Template::Error: undefined method `has_opted_for_meal_service' for nil:NilClass
app/avo/resources/client_resource.rb:292:in `block (4 levels) in <class:ClientResource>'
The line throwing the error is for a tab that is conditionally visible. We do that with this code:
ruby
tab "Meal" do
panel do
with_options visible: ->(resource:) { resource.model.has_opted_for_meal_service } do
Any ideas what might be causing resource.model to occasionally be nil? And/or how to shore up test setup/teardown/isolation so that it's more consistent?miniature-optician-85831
06/11/2024, 2:18 PMlemon-wall-20836
06/11/2024, 3:51 PMlemon-wall-20836
06/11/2024, 3:52 PMlemon-wall-20836
06/11/2024, 3:52 PMlemon-wall-20836
06/11/2024, 3:53 PMbetter-restaurant-41251
06/11/2024, 8:12 PMruby
test "editing a phone number that is already properly formatted" do
visit "/resources/clients/#{clients(:jane_smith).id}/edit"
fill_in("Emergency contact phone number", with: "212-300-4000", fill_options: {clear: :backspace})
click_on "Save"
click_on clients(:jane_smith).name
assert_text "EMERGENCY CONTACT PHONE NUMBER\n+1 212-300-4000", count: 1
endbetter-restaurant-41251
06/11/2024, 8:13 PMlemon-wall-20836
06/11/2024, 8:14 PMlemon-wall-20836
06/11/2024, 8:15 PMlemon-wall-20836
06/11/2024, 8:16 PMlemon-wall-20836
06/11/2024, 8:17 PMsleep or something similar?
I know it's not the most kosher approach. I would not smile if someone recommended that to mebetter-restaurant-41251
06/11/2024, 8:19 PMbetter-restaurant-41251
06/11/2024, 8:19 PMsleep.lemon-wall-20836
06/11/2024, 8:29 PMlemon-wall-20836
06/11/2024, 8:29 PM