Skip to content

Commit

Permalink
Fix bad script test
Browse files Browse the repository at this point in the history
It was using hard coded unique ids that failed due to a primary key conflict. Replaced with a dyanmic expression.
  • Loading branch information
atruskie committed Jul 8, 2020
1 parent bfe02ae commit 9891e5b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions spec/acceptance/scripts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]
}

Expand Down Expand Up @@ -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])
}
)
Expand Down

0 comments on commit 9891e5b

Please sign in to comment.