From 9891e5b143a550122b64a5ff14e0656d1798f0ad Mon Sep 17 00:00:00 2001 From: Anthony Truskinger Date: Wed, 8 Jul 2020 14:27:14 +1000 Subject: [PATCH] Fix bad script test It was using hard coded unique ids that failed due to a primary key conflict. Replaced with a dyanmic expression. --- spec/acceptance/scripts_spec.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/acceptance/scripts_spec.rb b/spec/acceptance/scripts_spec.rb index 7356adca..815c8fe6 100644 --- a/spec/acceptance/scripts_spec.rb +++ b/spec/acceptance/scripts_spec.rb @@ -19,10 +19,11 @@ def scripts_id_param # create extra scripts - grouping really needs to be tested with multiple items let!(:extra_scripts) { + parent = FactoryBot.create(:script, version: 1.0) [ - FactoryBot.create(:script, version: 1.0, id: 1234), - FactoryBot.create(:script, version: 1.5, group_id: 1234), - FactoryBot.create(:script, version: 1.6, group_id: 1234) + parent, + FactoryBot.create(:script, version: 1.5, group_id: parent.id), + FactoryBot.create(:script, version: 1.6, group_id: parent.id) ] } @@ -87,11 +88,12 @@ def scripts_id_param '"filter":{"is_last_version":{"eq":"true"}}', '"is_first_version":true', '"is_last_version":true', - '"version":1.6,"group_id":1234', + '"version":1.6,"group_id":%{group_id}', '"version":%{version},"group_id":%{group_id}' ] }, &proc { |context, opts| + opts[:response_body_content][3] = format(opts[:response_body_content][3], group_id: context.extra_scripts.last[:group_id]) opts[:response_body_content][4] = format(opts[:response_body_content][4], version: context.script[:version], group_id: context.script[:group_id]) } )