From 61357afba7f077e27255e746f6d92533365a723e Mon Sep 17 00:00:00 2001 From: kikito Date: Wed, 16 Dec 2015 18:47:28 +0100 Subject: [PATCH] Fixes failing tests (now you can not edit/destroy annotations unless you are their author!) --- spec/features/legislation_spec.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spec/features/legislation_spec.rb b/spec/features/legislation_spec.rb index dfde8674b..13a4b76b9 100644 --- a/spec/features/legislation_spec.rb +++ b/spec/features/legislation_spec.rb @@ -13,7 +13,8 @@ feature 'Legislation' do context 'Annotations', :js do - background { login_as(create :user) } + let(:user) { create(:user) } + background { login_as user } scenario 'Create' do legislation = create(:legislation, body: "In order to achieve...") @@ -35,7 +36,7 @@ feature 'Legislation' do scenario 'Update' do legislation = create(:legislation, 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}]) + create(:annotation, user: user, legislation: legislation, text: "this one" , quote: "In order to achieve...", ranges: [{"start"=>"/div[2]", "startOffset"=>12, "end"=>"/div[2]", "endOffset"=>19}]) visit legislation_path(legislation) @@ -56,7 +57,7 @@ feature 'Legislation' do scenario 'Destroy' do legislation = create(:legislation, body: "In order to achieve...") - annotation = create(:annotation, legislation: legislation, text: "this one" , quote: "achieve", ranges: [{"start"=>"/div[2]", "startOffset"=>12, "end"=>"/div[2]", "endOffset"=>19}]) + annotation = create(:annotation, user: user, legislation: legislation, text: "this one" , quote: "achieve", ranges: [{"start"=>"/div[2]", "startOffset"=>12, "end"=>"/div[2]", "endOffset"=>19}]) visit legislation_path(legislation)