diff --git a/spec/stimulus/turbo_spec.rb b/spec/stimulus/turbo_spec.rb index 5697a729..c7593a75 100644 --- a/spec/stimulus/turbo_spec.rb +++ b/spec/stimulus/turbo_spec.rb @@ -52,7 +52,10 @@ fill_in author_field, with: comment.author fill_in text_field, with: comment.text click_button("Post") - sleep(1) + + # This will ensure we wait enough for the changes to be applied + expect(page).to have_text("") + expect(Comment.all.count).to equal(new_comment_count) end