From 4c7cf46f3a908b082fe4649615d77c3ecd6f8801 Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 10 Sep 2019 15:47:33 +0100 Subject: [PATCH] Fix: flaky test breaks when fabricator produces apostrophe name - Nokogriri::CSS::SyntaxError: expect(page).to have_css("span[title='#{permissions.members.last.full_name}']") - the programmer needed to use two sets of quotes. Double quotes for the have_css string and single quotes for the nested CSS attribute for title's value. - When the fabricator produced a standard name like smith or Jones it worked - about 9 times in 10. - When the fabricator produced a name with an apostrophe in it it broke the test, about 1 in 10 times, because the CSS attribute was: title='O'Conner' and the string became unbalanced --- spec/features/admin/meeting_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/features/admin/meeting_spec.rb b/spec/features/admin/meeting_spec.rb index a9a84a14c..2e98ada35 100644 --- a/spec/features/admin/meeting_spec.rb +++ b/spec/features/admin/meeting_spec.rb @@ -58,8 +58,8 @@ click_on 'Update' expect(page).to have_content('You have succesfully updated the details of this meeting') - expect(page).to have_css("span[title='#{permissions.members.last.full_name}']") - expect(page).to_not have_css("span[title='#{permissions.members.first.full_name}']") + expect(page).to have_css(%(span[title="#{permissions.members.last.full_name}"])) + expect(page).to_not have_css(%(span[title="#{permissions.members.first.full_name}"])) end end