From 1512e944df275d8b8b9d4a3246ee68b66f666a01 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 15 Dec 2015 19:03:31 +0100 Subject: [PATCH] adds update annotation spec --- spec/features/legislation_spec.rb | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/spec/features/legislation_spec.rb b/spec/features/legislation_spec.rb index e3b2e7753..0549656b5 100644 --- a/spec/features/legislation_spec.rb +++ b/spec/features/legislation_spec.rb @@ -11,7 +11,7 @@ feature 'Legislation' do expect(page).to have_content 'To achieve this...' end - context 'Annotations', :js, :focus do + context 'Annotations', :js do scenario 'Create' do user = create(:user) @@ -49,7 +49,28 @@ feature 'Legislation' do end end - scenario 'Update' + scenario 'Update' do + user = create(:user) + legislation = create(:legislation, title: 'Participatory Democracy', body: "In order to achieve...") + annotation = create(:annotation, legislation: legislation, text: "this one" , quote: "In order to achieve...", ranges: [{"start"=>"/div[2]", "startOffset"=>12, "end"=>"/div[2]", "endOffset"=>19}]) + + login_as(user) + visit legislation_path(legislation) + + page.find(:css, ".annotator-hl").click + page.find(:css, ".annotator-edit").click + + fill_in 'annotator-field-0', with: 'editing my annotation' + page.find(:css, ".annotator-controls a[href='#save']").click + + page.find(:css, ".annotator-hl").click + expect(page).to have_css ".annotator-item", text: 'editing my annotation' + + visit legislation_path(legislation) + page.find(:css, ".annotator-hl").click + expect(page).to have_css ".annotator-item", text: 'editing my annotation' + end + scenario 'Destroy' end