Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@andriy-baran
Created April 26, 2018 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andriy-baran/c0dcb8dba5173879dd6402ac0f6788e9 to your computer and use it in GitHub Desktop.
Save andriy-baran/c0dcb8dba5173879dd6402ac0f6788e9 to your computer and use it in GitHub Desktop.
factory :search_results_resps, class: 'OpenStruct' do
variant_id { variant.id }
product_name { variant.product.name }
product_brand_name { variant.product.brand_name.to_s }
flavor { variant.flavor.to_s }
warehouse_category { variant.product.warehouse_category.to_s }
skip_container { variant.skip_container }
transient do
variant nil
end
end
# In test example
FactoryBot.attributes_for(:search_results_resps, variant: product.variants.first)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment