Skip to content

Commit

Permalink
Improve VariantsController request spec realism
Browse files Browse the repository at this point in the history
For this endpoint use the q parameter with Ransack variant_search_term
has to be a falsy value/not exist. By default, variantAutocomplete has
variant_search_term defined and needs to be overriden if ransack wants
to be used.
  • Loading branch information
RyanofWoods committed Dec 2, 2022
1 parent f66dba7 commit e021613
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/spec/requests/spree/api/variants_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module Spree::Api

it 'can query the results through ransack' do
expected_result = create(:variant, sku: 'FOOBAR')
get spree.api_variants_path, params: { q: { sku_cont: 'FOO' } }
get spree.api_variants_path, params: { variant_search_term: nil, q: { sku_cont: 'FOO' } }
expect(json_response['count']).to eq(1)
expect(json_response['variants'].first['sku']).to eq expected_result.sku
end
Expand Down

0 comments on commit e021613

Please sign in to comment.