solidus_importer 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +35 -0
  3. data/.gem_release.yml +5 -0
  4. data/.github/stale.yml +17 -0
  5. data/.gitignore +20 -0
  6. data/.hound.yml +8 -0
  7. data/.rspec +2 -0
  8. data/.rubocop.yml +2 -0
  9. data/Gemfile +33 -0
  10. data/LICENSE +26 -0
  11. data/README.md +170 -0
  12. data/Rakefile +6 -0
  13. data/app/assets/javascripts/spree/backend/solidus_importer.js +2 -0
  14. data/app/assets/javascripts/spree/frontend/solidus_importer.js +2 -0
  15. data/app/assets/stylesheets/spree/backend/solidus_importer.css +16 -0
  16. data/app/assets/stylesheets/spree/frontend/solidus_importer.css +4 -0
  17. data/app/controllers/spree/admin/solidus_importer/import_rows_controller.rb +24 -0
  18. data/app/controllers/spree/admin/solidus_importer/imports_controller.rb +44 -0
  19. data/app/jobs/solidus_importer/import_job.rb +30 -0
  20. data/app/models/solidus_importer/import.rb +48 -0
  21. data/app/models/solidus_importer/row.rb +26 -0
  22. data/app/views/spree/admin/solidus_importer/import_rows/show.html.erb +46 -0
  23. data/app/views/spree/admin/solidus_importer/imports/_form.html.erb +14 -0
  24. data/app/views/spree/admin/solidus_importer/imports/index.html.erb +80 -0
  25. data/app/views/spree/admin/solidus_importer/imports/new.html.erb +13 -0
  26. data/app/views/spree/admin/solidus_importer/imports/show.html.erb +87 -0
  27. data/bin/console +17 -0
  28. data/bin/rails +7 -0
  29. data/bin/rails-engine +13 -0
  30. data/bin/rails-sandbox +16 -0
  31. data/bin/rake +7 -0
  32. data/bin/sandbox +84 -0
  33. data/bin/setup +8 -0
  34. data/config/initializers/spree.rb +11 -0
  35. data/config/locales/en.yml +28 -0
  36. data/config/routes.rb +11 -0
  37. data/db/migrate/20191216101011_create_solidus_importer_imports.rb +19 -0
  38. data/db/migrate/20191216101012_create_solidus_importer_rows.rb +14 -0
  39. data/examples/importers/custom_importer.rb +20 -0
  40. data/examples/processors/notify_on_failure.rb +22 -0
  41. data/lib/generators/solidus_importer/install/install_generator.rb +22 -0
  42. data/lib/solidus_importer.rb +25 -0
  43. data/lib/solidus_importer/base_importer.rb +26 -0
  44. data/lib/solidus_importer/configuration.rb +39 -0
  45. data/lib/solidus_importer/engine.rb +23 -0
  46. data/lib/solidus_importer/exception.rb +5 -0
  47. data/lib/solidus_importer/factories.rb +4 -0
  48. data/lib/solidus_importer/process_import.rb +88 -0
  49. data/lib/solidus_importer/process_row.rb +46 -0
  50. data/lib/solidus_importer/processors/address.rb +47 -0
  51. data/lib/solidus_importer/processors/base.rb +15 -0
  52. data/lib/solidus_importer/processors/customer.rb +41 -0
  53. data/lib/solidus_importer/processors/log.rb +15 -0
  54. data/lib/solidus_importer/processors/option_types.rb +43 -0
  55. data/lib/solidus_importer/processors/option_values.rb +49 -0
  56. data/lib/solidus_importer/processors/order.rb +40 -0
  57. data/lib/solidus_importer/processors/product.rb +51 -0
  58. data/lib/solidus_importer/processors/product_images.rb +30 -0
  59. data/lib/solidus_importer/processors/taxon.rb +52 -0
  60. data/lib/solidus_importer/processors/variant.rb +51 -0
  61. data/lib/solidus_importer/processors/variant_images.rb +30 -0
  62. data/lib/solidus_importer/version.rb +5 -0
  63. data/solidus_importer.gemspec +36 -0
  64. data/spec/factories/solidus_importer_imports.rb +27 -0
  65. data/spec/factories/solidus_importer_rows.rb +82 -0
  66. data/spec/features/admin/solidus_importer/import_rows_spec.rb +30 -0
  67. data/spec/features/admin/solidus_importer/imports_spec.rb +121 -0
  68. data/spec/features/solidus_importer/import_spec.rb +138 -0
  69. data/spec/features/solidus_importer/processors_spec.rb +53 -0
  70. data/spec/fixtures/solidus_importer/apparel.csv +23 -0
  71. data/spec/fixtures/solidus_importer/customers.csv +3 -0
  72. data/spec/fixtures/solidus_importer/home-and-garden.csv +22 -0
  73. data/spec/fixtures/solidus_importer/invalid_headers.csv +3 -0
  74. data/spec/fixtures/solidus_importer/invalid_product.csv +2 -0
  75. data/spec/fixtures/solidus_importer/jewelery.csv +55 -0
  76. data/spec/fixtures/solidus_importer/orders.csv +5 -0
  77. data/spec/fixtures/solidus_importer/products.csv +8 -0
  78. data/spec/fixtures/solidus_importer/thinking-cat.jpg +0 -0
  79. data/spec/jobs/solidus_importer/import_job_spec.rb +54 -0
  80. data/spec/lib/solidus_importer/base_importer_spec.rb +23 -0
  81. data/spec/lib/solidus_importer/process_import_spec.rb +74 -0
  82. data/spec/lib/solidus_importer/process_row_spec.rb +24 -0
  83. data/spec/lib/solidus_importer/processors/address_spec.rb +18 -0
  84. data/spec/lib/solidus_importer/processors/base_spec.rb +9 -0
  85. data/spec/lib/solidus_importer/processors/customer_spec.rb +65 -0
  86. data/spec/lib/solidus_importer/processors/log_spec.rb +18 -0
  87. data/spec/lib/solidus_importer/processors/option_types_spec.rb +38 -0
  88. data/spec/lib/solidus_importer/processors/option_values_spec.rb +43 -0
  89. data/spec/lib/solidus_importer/processors/order_spec.rb +56 -0
  90. data/spec/lib/solidus_importer/processors/product_images_spec.rb +42 -0
  91. data/spec/lib/solidus_importer/processors/product_spec.rb +66 -0
  92. data/spec/lib/solidus_importer/processors/taxon_spec.rb +33 -0
  93. data/spec/lib/solidus_importer/processors/variant_images_spec.rb +44 -0
  94. data/spec/lib/solidus_importer/processors/variant_spec.rb +86 -0
  95. data/spec/lib/solidus_importer_spec.rb +14 -0
  96. data/spec/models/solidus_importer/import_spec.rb +60 -0
  97. data/spec/models/solidus_importer/row_spec.rb +18 -0
  98. data/spec/spec_helper.rb +27 -0
  99. data/spec/support/solidus_importer_helpers.rb +13 -0
  100. metadata +227 -0
@@ -0,0 +1,23 @@
1
+ Handle,Title,Body (HTML),Vendor,Type,Tags,Published,Option1 Name,Option1 Value,Option2 Name,Option2 Value,Option3 Name,Option3 Value,Variant SKU,Variant Grams,Variant Inventory Tracker,Variant Inventory Qty,Variant Inventory Policy,Variant Fulfillment Service,Variant Price,Variant Compare At Price,Variant Requires Shipping,Variant Taxable,Variant Barcode,Image Src,Image Position,Image Alt Text,Gift Card,SEO Title,SEO Description,Google Shopping / Google Product Category,Google Shopping / Gender,Google Shopping / Age Group,Google Shopping / MPN,Google Shopping / AdWords Grouping,Google Shopping / AdWords Labels,Google Shopping / Condition,Google Shopping / Custom Product,Google Shopping / Custom Label 0,Google Shopping / Custom Label 1,Google Shopping / Custom Label 2,Google Shopping / Custom Label 3,Google Shopping / Custom Label 4,Variant Image,Variant Weight Unit,Variant Tax Code
2
+ ocean-blue-shirt,Ocean Blue Shirt,Ocean blue cotton shirt with a narrow collar and buttons down the front and long sleeves. Comfortable fit and tiled kalidoscope patterns. ,partners-demo,,men,true,Title,Default Title,,,,,,0,,1,deny,manual,50,,true,true,,https://burst.shopifycdn.com/photos/young-man-in-bright-fashion_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
3
+ classic-varsity-top,Classic Varsity Top,"Womens casual varsity top, This grey and black buttoned top is a sport-inspired piece complete with an embroidered letter. ",partners-demo,,women,true,Size,Small,,,,,,0,,1,deny,manual,60,,true,true,,https://burst.shopifycdn.com/photos/casual-fashion-woman_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
4
+ classic-varsity-top,,,,,,,,Medium,,,,,,0,,1,deny,manual,60,,true,true,,,,,,,,,,,,,,,,,,,,,,kg,
5
+ classic-varsity-top,,,,,,,,Large,,,,,,0,,1,deny,manual,60,,true,true,,,,,,,,,,,,,,,,,,,,,,kg,
6
+ yellow-wool-jumper,Yellow Wool Jumper,Knitted jumper in a soft wool blend with low dropped shoulders and wide sleeves and think cuffs. Perfect for keeping warm during Fall. ,partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,80,,true,true,,https://burst.shopifycdn.com/photos/autumn-photographer-taking-picture_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
7
+ floral-white-top,Floral White Top,Stylish sleeveless white top with a floral pattern. ,partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,75,,true,true,,https://burst.shopifycdn.com/photos/city-woman-fashion_925x@2x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
8
+ striped-silk-blouse,Striped Silk Blouse,Ultra-stylish black and red striped silk blouse with buckle collar and matching button pants. ,partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,50,,true,true,,https://burst.shopifycdn.com/photos/striped-blouse-fashion_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
9
+ classic-leather-jacket,Classic Leather Jacket,"Womans zipped leather jacket. Adjustable belt for a comfortable fit, complete with shoulder pads and front zip pocket. ",partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,80,,true,true,,https://burst.shopifycdn.com/photos/leather-jacket-and-tea_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
10
+ dark-denim-top,Dark Denim Top,"Classic dark denim top with chest pockets, long sleeves with buttoned cuffs, and a ripped hem effect.",partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,60,,true,true,,https://burst.shopifycdn.com/photos/young-female-models-denim_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
11
+ navy-sport-jacket,Navy Sports Jacket,"Long-sleeved navy waterproof jacket in thin, polyester fabric with a soft mesh inside. The durable water-repellent finish means you'll be kept comfortable and protected when out in all weathers.",partners-demo,,men,true,Title,Default Title,,,,,,0,,1,deny,manual,60,,true,true,,https://burst.shopifycdn.com/photos/mens-fall-fashion-jacket_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
12
+ dark-winter-jacket,Soft Winter Jacket,"Thick black winter jacket, with soft fleece lining. Perfect for those cold weather days.",partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,50,,true,true,,https://burst.shopifycdn.com/photos/smiling-woman-on-snowy-afternoon_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
13
+ black-leather-bag,Black Leather Bag,"Womens black leather bag, with ample space. Can be worn over the shoulder, or remove straps to carry in your hand. ",partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,30,,true,true,,https://burst.shopifycdn.com/photos/black-bag-over-the-shoulder_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
14
+ zipped-jacket,Zipped Jacket,Dark navy and light blue men's zipped waterproof jacket with an outer zipped chestpocket for easy storeage.,partners-demo,,men,true,Title,Default Title,,,,,,0,,1,deny,manual,65,,true,true,,https://burst.shopifycdn.com/photos/menswear-blue-zip-up-jacket_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
15
+ silk-summer-top,Silk Summer Top,Silk womens top with short sleeves and number pattern.,partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,70,,true,true,,https://burst.shopifycdn.com/photos/young-hip-woman-at-carnival_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
16
+ longsleeve-cotton-top,Long Sleeve Cotton Top,"Black cotton womens top, with long sleeves, no collar and a thick hem. ",partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,50,,true,true,,https://burst.shopifycdn.com/photos/woman-outside-brownstone_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
17
+ chequered-red-shirt,Chequered Red Shirt,"Classic mens plaid flannel shirt with long sleeves, in chequered style, with two chest pockets.",partners-demo,,men,true,Title,Default Title,,,,,,0,,1,deny,manual,50,,true,true,,https://burst.shopifycdn.com/photos/red-plaid-shirt_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
18
+ white-cotton-shirt,White Cotton Shirt,Plain white cotton long sleeved shirt with loose collar. Small buttons and front pocket. ,partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,30,,true,true,,https://burst.shopifycdn.com/photos/smiling-woman-poses_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
19
+ olive-green-jacket,Olive Green Jacket,Loose fitting olive green jacket with buttons and large pockets. Multicoloured pattern on the front of the shoulders.,partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,65,,true,true,,https://burst.shopifycdn.com/photos/urban-fashion_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
20
+ blue-silk-tuxedo,Blue Silk Tuxedo,Blue silk tuxedo with marbled aquatic pattern and dark lining. Sleeves are complete with rounded hem and black buttons.,partners-demo,,men,true,Title,Default Title,,,,,,0,,1,deny,manual,70,,true,true,,https://burst.shopifycdn.com/photos/man-adjusts-blue-tuxedo-bowtie_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
21
+ red-sports-tee,Red Sports Tee,Women's red sporty t-shirt with colorful details on the sleeves and a small white pocket.,partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,50,,true,true,,https://burst.shopifycdn.com/photos/womens-red-t-shirt_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
22
+ striped-skirt-and-top,Striped Skirt and Top,Black cotton top with matching striped skirt. ,partners-demo,,women,true,Title,Default Title,,,,,,0,,1,deny,manual,50,,true,true,,https://burst.shopifycdn.com/photos/woman-in-the-city_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
23
+ led-high-tops,LED High Tops,"Black high top shoes with green LED lights in the sole, tied up with laces and a buckle. ",partners-demo,,men,true,Title,Default Title,,,,,,0,,1,deny,manual,80,,true,true,,https://burst.shopifycdn.com/photos/putting-on-your-shoes_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
@@ -0,0 +1,3 @@
1
+ First Name,Last Name,Email
2
+ Jane,Doe,jane.doe01520022060@example.com
3
+ Jane,Doe,jane.doe11520022060@example.com
@@ -0,0 +1,22 @@
1
+ Handle,Title,Body (HTML),Vendor,Type,Tags,Published,Option1 Name,Option1 Value,Option2 Name,Option2 Value,Option3 Name,Option3 Value,Variant SKU,Variant Grams,Variant Inventory Tracker,Variant Inventory Qty,Variant Inventory Policy,Variant Fulfillment Service,Variant Price,Variant Compare At Price,Variant Requires Shipping,Variant Taxable,Variant Barcode,Image Src,Image Position,Image Alt Text,Gift Card,SEO Title,SEO Description,Google Shopping / Google Product Category,Google Shopping / Gender,Google Shopping / Age Group,Google Shopping / MPN,Google Shopping / AdWords Grouping,Google Shopping / AdWords Labels,Google Shopping / Condition,Google Shopping / Custom Product,Google Shopping / Custom Label 0,Google Shopping / Custom Label 1,Google Shopping / Custom Label 2,Google Shopping / Custom Label 3,Google Shopping / Custom Label 4,Variant Image,Variant Weight Unit,Variant Tax Code,Cost per item
2
+ clay-plant-pot,Clay Plant Pot,<p>Classic blown clay pot for plants</p>,Company 123,Outdoor,"Pot, Plants",true,Size,Regular,,,,,,0,,1,deny,manual,9.99,,true,true,,https://burst.shopifycdn.com/photos/single-sprout-in-a-pot_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
3
+ clay-plant-pot,,,,,,,,Large,,,,,,0,,3,deny,manual,15.99,,true,true,,https://burst.shopifycdn.com/photos/pot-with-a-single-sprout_925x.jpg,2,,,,,,,,,,,,,,,,,,,kg,,
4
+ copper-light,Copper Light,<p>Stylish copper bedside light</p>,Company 123,Indoor,"Copper, Bedroom",true,Title,Default Title,,,,,,0,,2,deny,manual,59.99,75,true,true,,https://burst.shopifycdn.com/photos/copper-light-in-bedroom_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
5
+ cream-sofa,Cream Sofa,<p>Comfortable cream sofa with wooden base</p>,Company 123,Indoor,"Couch, Wood",true,Title,Default Title,,,,,,0,,4,deny,manual,500,750,true,true,,https://burst.shopifycdn.com/photos/condominium-interior-livingroom_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
6
+ antique-drawers,Antique Drawers,<p>Antique wooden chest of drawers</p>,Company 123,Indoor,"Antique, Bedroom",true,Title,Default Title,,,,,,0,,2,deny,manual,250,300,true,true,,https://burst.shopifycdn.com/photos/babys-room_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
7
+ white-bed-clothes,White Bed Clothes,<p>Sleek white bed clothes</p>,Company 123,Indoor,Bed,true,Title,Default Title,,,,,,0,,1,deny,manual,29.99,35,true,true,,https://burst.shopifycdn.com/photos/bright-hotel-room-bed_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
8
+ pink-armchair,Pink Armchair,<p>Stylish pink armchair</p>,Company 123,Indoor,Chair,true,Title,Default Title,,,,,,0,,0,deny,manual,750,,true,true,,https://burst.shopifycdn.com/photos/soft-pink-cushioned-armchair-in-stately-salon_925x.jpg,,,false,,,,,,,,,,,,,,,,,kg,,
9
+ wooden-outdoor-table,Wooden Outdoor Table,<p>Chic wooden outdoor garden table</p>,Rustic LTD,Outdoor,"Wood, Garden",true,Title,Default Title,,,,,,0,,3,deny,manual,99.99,,true,true,,https://burst.shopifycdn.com/photos/cafe-patio_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
10
+ brown-throw-pillows,Brown Throw Pillows,<p>Stylish brown throw pillows</p>,Rustic LTD,Indoor,Pillows,true,Title,Default Title,,,,,,0,,5,deny,manual,19.99,25.99,true,true,,https://burst.shopifycdn.com/photos/bedroom-bed-with-brown-throw-pillows_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
11
+ white-ceramic-pot,White Ceramic Pot,<p>Homemade white ceramic flower pot</p>,Rustic LTD,Indoor,"Pot, Plants",true,Title,Default Title,,,,,,0,,1,deny,manual,15.99,30,true,true,,https://burst.shopifycdn.com/photos/house-plant-in-white-pot_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
12
+ yellow-watering-can,Yellow watering can,<p>Vintage vibrant watering can</p>,Rustic LTD,Outdoor,Plants,true,Title,Default Title,,,,,,0,,4,deny,manual,40.99,50,true,true,,https://burst.shopifycdn.com/photos/flowers-in-yellow-watering-can_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
13
+ gardening-hand-trowel,Gardening hand trowel,<p>Metal gardening hand trowel with wooden handle</p>,Rustic LTD,Outdoor,Plants,true,Title,Default Title,,,,,,0,,2,deny,manual,10.99,25,true,true,,https://burst.shopifycdn.com/photos/spring-gardening-set-up_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
14
+ biodegradable-cardboard-pots,Biodegradable cardboard pots,<p>Biodegradable outdoor cardboard pots</p>,Rustic LTD,Outdoor,"Garden, Plants",true,Title,Default Title,,,,,,0,shopify,8,deny,manual,10,,true,true,,https://burst.shopifycdn.com/photos/potted-seeds_925x.jpg,,,false,,,,,,,,,,,,,,,,,kg,,
15
+ grey-sofa,Grey Sofa,<p>Large four seater grey sofa</p>,Rustic LTD,Indoor,Sofa,true,Title,Default Title,,,,,,0,,6,deny,manual,29.99,35,true,true,,https://burst.shopifycdn.com/photos/large-grey-sofa-by-brick-wall_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
16
+ wooden-outdoor-slats,Wooden outdoor slats,<p>Wooden outdoor fencing slats</p>,Rustic LTD,Outdoor,"Wood, Garden",true,Title,Default Title,,,,,,0,,0,deny,manual,25.99,35,true,true,,https://burst.shopifycdn.com/photos/house-plant-on-wooden-slat-wall_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
17
+ wooden-fence,Wooden Fence,<p>Wooden garden fence</p>,Rustic LTD,Outdoor,"Garden, Wood",true,Title,Default Title,,,,,,0,,5,deny,manual,200,300,true,true,,https://burst.shopifycdn.com/photos/picket-fence-flowers_925x.jpg,,,false,,,,,,,,,,,,,,,,,kg,,
18
+ yellow-sofa,Yellow Sofa,<p>Two seater yellow sofa with wooden legs</p>,Home Sweet Home,Indoor,Sofa,true,Title,Default Title,,,,,,0,,5,deny,manual,99.99,150,true,true,,https://burst.shopifycdn.com/photos/yellow-couch-by-black-and-white-mural_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
19
+ knitted-throw-pillows,Knitted Throw Pillows,<p>Homemade knitted throw pillows in a variety of colors</p>,Home Sweet Home,Indoor,Pillows,true,Title,Default Title,,,,,,0,,1,deny,manual,19.99,25.99,true,true,,https://burst.shopifycdn.com/photos/yellow-sofa-with-throw-pillows_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
20
+ vanilla-candle,Vanilla candle,<p>Vanilla scent candle in jar</p>,Home Sweet Home,Indoor,Candle,true,Title,Default Title,,,,,,0,,5,deny,manual,15.99,30,true,true,,https://burst.shopifycdn.com/photos/diy-organic-candle_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
21
+ black-bean-bag,Black Beanbag,<p>Black leather beanbag</p>,Company 123,Indoor,"Black, Leather",true,Title,Default Title,,,,,,0,,6,deny,manual,69.99,80,true,true,,https://burst.shopifycdn.com/photos/comfortable-living-room-cat_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
22
+ bedside-table,Bedside Table,<p>Wooden bedside table</p>,Company 123,Indoor,"Wood, Bedroom",true,Title,Default Title,,,,,,0,,1,deny,manual,69.99,85,true,true,,https://burst.shopifycdn.com/photos/dark-wall-bedside-table_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,,
@@ -0,0 +1,3 @@
1
+ ,,
2
+ Jane,Doe,jane.doe01520022060@example.com
3
+ Jane,Doe,jane.doe11520022060@example.com
@@ -0,0 +1,2 @@
1
+ Handle,Title,Body (HTML),Vendor,Type,Tags,Template Suffix,Published Scope,Published,Published At,Option1 Name,Option1 Value,Option2 Name,Option2 Value,Option3 Name,Option3 Value,Variant SKU,Metafields Global Title Tag,Metafields Global Description Tag,Metafield Namespace,Metafield Key,Metafield Value,Metafield Value Type,Variant Grams,Variant Inventory Tracker,Variant Inventory Qty,Variant Inventory Policy,Variant Fulfillment Service,Variant Price,Variant Compare At Price,Variant Requires Shipping,Variant Taxable,Variant Barcode,Image Attachment,Image Src,Image Position,Image Alt Text,Variant Image,Variant Weight,Variant Weight Unit,Variant Tax Code
2
+ hightop-sports-sneaker,,,,,,,,,,,,,,,,,,,global,manufacturer,Surf shoe co,string,,,,,,,,,,,,,,,,,,
@@ -0,0 +1,55 @@
1
+ Handle,Title,Body (HTML),Vendor,Type,Tags,Published,Option1 Name,Option1 Value,Option2 Name,Option2 Value,Option3 Name,Option3 Value,Variant SKU,Variant Grams,Variant Inventory Tracker,Variant Inventory Qty,Variant Inventory Policy,Variant Fulfillment Service,Variant Price,Variant Compare At Price,Variant Requires Shipping,Variant Taxable,Variant Barcode,Image Src,Image Position,Image Alt Text,Gift Card,SEO Title,SEO Description,Google Shopping / Google Product Category,Google Shopping / Gender,Google Shopping / Age Group,Google Shopping / MPN,Google Shopping / AdWords Grouping,Google Shopping / AdWords Labels,Google Shopping / Condition,Google Shopping / Custom Product,Google Shopping / Custom Label 0,Google Shopping / Custom Label 1,Google Shopping / Custom Label 2,Google Shopping / Custom Label 3,Google Shopping / Custom Label 4,Variant Image,Variant Weight Unit,Variant Tax Code
2
+ chain-bracelet,7 Shakra Bracelet,"7 chakra bracelet, in blue or black.",Company 123,Bracelet,Beads,true,Color,Blue,,,,,,0,,1,deny,manual,42.99,44.99,true,true,,https://burst.shopifycdn.com/photos/7-chakra-bracelet_925x.jpg,1,,false,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/navy-blue-chakra-bracelet_925x.jpg,kg,
3
+ chain-bracelet,,,,,,,,Black,,,,,,0,,0,deny,manual,42.99,44.99,true,true,,https://burst.shopifycdn.com/photos/navy-blue-chakra-bracelet_925x.jpg,2,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/7-chakra-bracelet_925x.jpg,kg,
4
+ leather-anchor,Anchor Bracelet Mens,Black leather bracelet with gold or silver anchor for men.,Company 123,Bracelet,"Anchor, Gold, Leather, Silver",true,Color,Gold,,,,,,0,,1,deny,manual,69.99,85,true,true,,https://burst.shopifycdn.com/photos/anchor-bracelet-mens_925x.jpg,1,,false,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/anchor-bracelet-mens_925x.jpg,kg,
5
+ leather-anchor,,,,,,,,Silver,,,,,,0,,0,deny,manual,55,85,true,true,,https://burst.shopifycdn.com/photos/anchor-bracelet-for-men_925x.jpg,2,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/anchor-bracelet-for-men_925x.jpg,kg,
6
+ leather-anchor,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/leather-anchor-bracelet-for-men_925x.jpg,3,,,,,,,,,,,,,,,,,,,,
7
+ bangle-bracelet,Bangle Bracelet,Gold bangle bracelet with studded jewels.,Company 123,Bracelet,"Diamond, Gem, Gold",true,Title,Default Title,,,,,,0,,1,deny,manual,39.99,43.99,true,true,,https://burst.shopifycdn.com/photos/bangle-bracelet-with-jewels_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
8
+ bangle-bracelet-with-feathers,Boho Bangle Bracelet,Gold boho bangle bracelet with multicolor tassels.,Company 123,Bracelet,Gold,true,Title,Default Title,,,,,,0,,1,deny,manual,42.99,44.99,true,true,,https://burst.shopifycdn.com/photos/bangle-bracelet-with-feathers_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
9
+ boho-earrings,Boho Earrings,Turquoise globe earrings on 14k gold hooks.,Company 123,Earrings,"Silver, Turquoise",true,Title,Default Title,,,,,,28,,1,deny,manual,27.99,35.99,true,true,,https://burst.shopifycdn.com/photos/boho-earrings_925x.jpg,1,,false,,,,,,,,,,,,,,,,,oz,
10
+ boho-earrings,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/inspired-woman_925x.jpg,2,,,,,,,,,,,,,,,,,,,,
11
+ boho-earrings,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/necklace-earrings-set_925x.jpg,3,,,,,,,,,,,,,,,,,,,,
12
+ choker-with-bead,Choker with Bead,Black choker necklace with 14k gold bead.,Company 123,Necklace,"Gold, Leather",true,Title,Default Title,,,,,,0,,1,deny,manual,14.99,19.99,true,true,,https://burst.shopifycdn.com/photos/black-choker-with-bead_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
13
+ choker-with-bead,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/choker-with-bead_925x.jpg,2,,,,,,,,,,,,,,,,,,,,
14
+ choker-with-gold-pendant,Choker with Gold Pendant,"Black cord choker with gold pendant. Beautifully died black leather shapes a choker necklace with findings of 14k yellow gold, displaying gold pendant in a gorgeous balance of dark and light, delicate and strong.
<ul>
15
+ <li>14k yellow gold</li>
16
+ <li>Leather</li>
17
+ <li>Length, 12"" with 2.5"" extender</li>
18
+ <li>Width, 0.3""</li>
19
+ <li>Lobster clasp</li>
20
+ <li>Made in USA</li>
21
+ </ul>",Company 123,Necklace,"Choker, Gold, Leather, Pendant",true,Title,Default Title,,,,,,0,,1,deny,manual,29.99,,true,true,,https://burst.shopifycdn.com/photos/choker-with-gold-pendant_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
22
+ choker-with-gold-pendant,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/choker-pendant-closeup_925x.jpg,2,,,,,,,,,,,,,,,,,,,,
23
+ choker-with-triangle,Choker with Triangle,Black choker with silver triangle pendant.,Company 123,Necklace,"Leather, Silver, Triangle",true,Title,Default Title,,,,,,0,,1,deny,manual,47.99,49.99,true,true,,https://burst.shopifycdn.com/photos/choker-with-triangle_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
24
+ dainty-gold-neclace,Dainty Gold Necklace,Dainty gold necklace with two pendants.,Company 123,Necklace,"Gold, Pendant",true,Title,Default Title,,,,,,0,,1,deny,manual,63.99,69.99,true,true,,https://burst.shopifycdn.com/photos/dainty-gold-necklace_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
25
+ dainty-gold-neclace,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/womens-gold-necklace_925x.jpg,2,,,,,,,,,,,,,,,,,,,,
26
+ dreamcatcher-pendant-necklace,Dreamcatcher Pendant Necklace,"Turquoise beaded dream catcher necklace. Silver feathers adorn this beautiful dream catcher, which move and twinkle as you walk.",Sterling Ltd,Necklace,"Dreamcatcher, Pendant, Silver, Turquoise",true,Title,Default Title,,,,,,0,,1,deny,manual,23.99,41.99,true,true,,https://burst.shopifycdn.com/photos/dreamcatcher-pendant-necklace_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
27
+ dreamcatcher-pendant-necklace,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/gold-dream-catcher-necklace_925x.jpg,2,,,,,,,,,,,,,,,,,,,,
28
+ galaxy-earrings,Galaxy Earrings,"One set of galaxy earrings, with sterling silver clasps.",Sterling Ltd,Earrings,"Blue, Galaxy, Silver",true,Title,Default Title,,,,,,0,,1,deny,manual,37.99,45.99,true,true,,https://burst.shopifycdn.com/photos/galaxy-earrings_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
29
+ gemstone,Gemstone Necklace,"<p>Gemstone pendant, housed in sterling silver, with sterling silver chain.</p>
30
+ <ul>
31
+ <li>Sterling silver chain, 14 inches</li>
32
+ <li>Turquoise or Quartz</li>
33
+ <li>Boho Chic</li>
34
+ <li>Made in USA</li>
35
+ </ul>",Sterling Ltd,Necklace,"Blue, Gem, Purple, Silver, Turquoise",true,Colour,Blue,,,,,,0,,1,deny,manual,27.99,29.99,true,true,,https://burst.shopifycdn.com/photos/blue-gemstone-pendant_925x.jpg,1,,false,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/blue-gemstone-pendant_925x.jpg,kg,
36
+ gemstone,,,,,,,,Purple,,,,,,0,,0,deny,manual,27.99,29.99,true,true,,https://burst.shopifycdn.com/photos/gemstone-necklace_925x.jpg,2,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/purple-gemstone-necklace_925x.jpg,kg,
37
+ gemstone,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/womens-necklace_925x.jpg,3,,,,,,,,,,,,,,,,,,,,
38
+ gemstone,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/purple-gemstone-necklace_925x.jpg,4,,,,,,,,,,,,,,,,,,,,
39
+ gold-bird-necklace,Gold Bird Necklace,"14k Gold delicate necklace, with bird between two chains.",Company 123,Necklace,"Bird, Gold",true,Title,Default Title,,,,,,0,,1,deny,manual,79.99,,true,true,,https://burst.shopifycdn.com/photos/gold-bird-necklace_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
40
+ looped-earrings,Gold Elephant Earrings,"Small 14k gold elephant earrings, with opal ear detail.",Company 123,Earrings,"Gold, Silver",true,Title,Default Title,,,,,,0,,1,deny,manual,54.99,,true,true,,https://burst.shopifycdn.com/photos/elephant-earrings_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
41
+ guardian-angel-earrings,Guardian Angel Earrings,Sterling silver guardian angel earrings with diamond gemstones.,Sterling Ltd,Earrings,"Angel, Silver",true,Title,Default Title,,,,,,0,,1,deny,manual,19.99,,true,true,,https://burst.shopifycdn.com/photos/guardian-angel-earrings_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
42
+ guardian-angel-earrings,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/guardian-angel-earring-closeup_925x.jpg,2,,,,,,,,,,,,,,,,,,,,
43
+ moon-charm-bracelet,Moon Charm Bracelet,Moon 14k gold chain friendship bracelet.,Company 123,Bracelet,"Gold, Moon",true,Title,Default Title,,,,,,0,,1,deny,manual,47.99,49.99,true,true,,https://burst.shopifycdn.com/photos/womens-hand-moon-bracelet-_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
44
+ moon-charm-bracelet,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/moon-friendship-bracelet_925x.jpg,2,,,,,,,,,,,,,,,,,,,,
45
+ moon-charm-bracelet,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/womens-hand-charm-bracelet_925x.jpg,3,,,,,,,,,,,,,,,,,,,,
46
+ origami-crane-necklace,Origami Crane Necklace,Sterling silver origami crane necklace.,Sterling Ltd,Necklace,"Crane, Origami, Silver",true,Title,Default Title,,,,,,0,,1,deny,manual,75.99,,true,true,,https://burst.shopifycdn.com/photos/origami-crane-necklace-gold_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
47
+ origami-crane-necklace,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/silver-origami-necklace_925x.jpg,2,,,,,,,,,,,,,,,,,,,,
48
+ origami-crane-necklace,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/origami-crane-necklace_925x.jpg,3,,,,,,,,,,,,,,,,,,,,
49
+ origami-crane-necklace,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/womens-green-turtleneck_925x.jpg,4,,,,,,,,,,,,,,,,,,,,
50
+ pretty-gold-necklace,Pretty Gold Necklace,14k gold and turquoise necklace. Stunning beaded turquoise on gold and pendant filled double chain design.,Company 123,Necklace,"Gold, Turquoise",true,Title,Default Title,,,,,,0,,1,deny,manual,44.95,63.99,true,true,,https://burst.shopifycdn.com/photos/pretty-gold-necklace_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
51
+ pretty-gold-necklace,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/necklace-earrings-set_925x.jpg,2,,,,,,,,,,,,,,,,,,,,
52
+ pretty-gold-necklace,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/inspired-woman_925x.jpg,3,,,,,,,,,,,,,,,,,,,,
53
+ silver-threader-necklace,Silver Threader Necklace,Sterling silver chain thread through circle necklace.,Sterling Ltd,Necklace,Silver,true,Title,Default Title,,,,,,0,,1,deny,manual,14.99,19.99,true,true,,https://burst.shopifycdn.com/photos/silver-threader-necklace_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
54
+ silver-threader-necklace,,,,,,,,,,,,,,,,,,,,,,,,https://burst.shopifycdn.com/photos/threader-necklace-closeup_925x.jpg,2,,,,,,,,,,,,,,,,,,,,
55
+ stylish-summer-neclace,Stylish Summer Necklace,Double chained gold boho necklace with turquoise pendant.,Company 123,Necklace,"Gold, Turquoise",true,Title,Default Title,,,,,,0,,1,deny,manual,44.99,,true,true,,https://burst.shopifycdn.com/photos/stylish-summer-necklace_925x.jpg,1,,false,,,,,,,,,,,,,,,,,kg,
@@ -0,0 +1,5 @@
1
+ Name,Email,Financial Status,Fulfillment Status,Currency,Buyer Accepts Marketing,Cancel Reason,Cancelled At,Closed At,Tags,Note,Phone,Referring Site,Processed At,Source name,Total weight,Total Tax,Shipping Company,Shipping Name,Shipping Phone,Shipping First Name,Shipping Last Name,Shipping Address1,Shipping Address2,Shipping City,Shipping Province,Shipping Province Code,Shipping Zip,Shipping Country,Shipping Country Code,Billing Company,Billing Name,Billing Phone,Billing First Name,Billing Last Name,Billing Address1,Billing Address2,Billing City,Billing Province,Billing Province Code,Billing Zip,Billing Country,Billing Country Code,Lineitem name,Lineitem quantity,Lineitem price,Lineitem sku,Lineitem requires shipping,Lineitem taxable,Lineitem fulfillment status,Tax 1 Title,Tax 1 Price,Tax 1 Rate,Tax 2 Title,Tax 2 Price,Tax 2 Rate,Tax 3 Title,Tax 3 Price,Tax 3 Rate,Transaction amount,Transaction kind,Transaction status,Shipping line code,Shipping line price,Shipping line title,Shipping line carrier identifier,Shipping Tax Price,Discount code,Discount amount,Discount type,Metafield Namespace,Metafield Key,Metafield Value,Metafield Value Type
2
+ #MA-1097,john.doe@acme.com,paid,unfulfilled,USD,true,,,,,"Review verified, discount code e-mailed",555 555-5555,http://acme-influencers.com,2018-01-04 15:51:23 -0800,,,,Acme Warehouse,Receiver Joe,555.555.5556,Receiver,Joe,57 Erb St W,,Waterloo,Ontario,ON,N2L 6C2,Canada,CA,Acme Ltd.,Ami Shaperi,555.555.5557,Ami,Shaperi,150 Elgin St,Unit 56,Ottawa,Ontario,ON,K2P 1L4,Canaada,CA,Garden Trowel - Composite / Small,2,10,a-123,true,true,fulfilled,HST,2.60,0.13,,,,,,,1000,sale,success,,,,,,25OFF,10,fixed_amount,instructions,wash,cold_water,string
3
+ #MA-1097,john.doe@acme.com,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Acme Ltd.,,,,,,,,,,,,,Mini Handle Shovel,3,20,a-456,true,true,fulfilled,HST,7.80,0.13,,,,,,500,refund,success,,,,,,,,,instructions,dry,tumble_dry,string
4
+ #MA-1097,john.doe@acme.com,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,United Parcel Service - 2nd Day Air,0,United Parcel Service - 2nd Day Air,ups_2DA,,,,,instructions,dry,tumble_dry,string
5
+ #MA-1098,jane.doe@acme.com,refunded,unfulfilled,USD,false,customer changed/cancelled order,2018-01-19 12:54:42 -0800,,,,,,2018-01-19 12:54:41 -0800,,,,,,,,,,,,,,,,,Acme Inc.,,,,,,,,,,,,,Big Brown Bear Boots,1,30,b-001,true,true,null,,,,,,,,,,,,,,,,,,,,,origin,country,China,string
@@ -0,0 +1,8 @@
1
+ Handle,Title,Body (HTML),Vendor,Type,Tags,Template Suffix,Published Scope,Published,Published At,Option1 Name,Option1 Value,Option2 Name,Option2 Value,Option3 Name,Option3 Value,Variant SKU,Metafields Global Title Tag,Metafields Global Description Tag,Metafield Namespace,Metafield Key,Metafield Value,Metafield Value Type,Variant Grams,Variant Inventory Tracker,Variant Inventory Qty,Variant Inventory Policy,Variant Fulfillment Service,Variant Price,Variant Compare At Price,Variant Requires Shipping,Variant Taxable,Variant Barcode,Image Attachment,Image Src,Image Position,Image Alt Text,Variant Image,Variant Weight,Variant Weight Unit,Variant Tax Code
2
+ hightop-sports-sneaker,Mens Casual Hightop Sports Shoe,"<p>Versatile show for athletic wear including running, basketball, and racquet sports</p>",Acme Shoe Co.,Footwear,"Hightop, Sports, Mens, Shoe",,web,true,2007-12-31T19:00:00-05:00,Color,,Size,,,,,,,,,,,,,,,,,,,,,,https://cdn.shopify.com/shopify-marketing_assets/static/tobias-lutke-shopify.jpg,1,hightop front view,,,,
3
+ hightop-sports-sneaker,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,https://cdn.shopify.com/shopify-marketing_assets/static/tobias-lutke-shopify.jpg,2,hightop side view,,,,
4
+ hightop-sports-sneaker,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,https://cdn.shopify.com/shopify-marketing_assets/static/tobias-lutke-shopify.jpg,3,hightop sole view,,,,
5
+ hightop-sports-sneaker,,,,,,,,,,,,,,,,,,,global,manufacturer,Surf shoe co,string,,,,,,,,,,,,,,,,,,
6
+ hightop-sports-sneaker,,,,,,,,true,2007-12-31T19:00:00-05:00,,White,,9.5,,,a-123,,,global,color_code,c123HJ,string,264,shopify,100,continue,manual,10.00,12.00,true,true,,,,,,https://cdn.shopify.com/shopify-marketing_assets/static/tobias-lutke-shopify.jpg,,g,
7
+ hightop-sports-sneaker,,,,,,,,true,2007-12-31T19:00:00-05:00,,Black,,10,,,a-456,,,global,lace_style,normal,string,345,shopify,150,deny,manual,20.00,15.00,true,true,,,,,,https://cdn.shopify.com/shopify-marketing_assets/static/tobias-lutke-shopify.jpg,,g,
8
+ hightop-sports-sneaker,,,,,,,,true,2007-12-31T19:00:00-05:00,,Blue,,6,,,b-001,,,global,tread_type,rugged,string,345,shopify,150,deny,manual,30.00,15.00,true,true,,,,,,https://cdn.shopify.com/shopify-marketing_assets/static/tobias-lutke-shopify.jpg,,g,
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe SolidusImporter::ImportJob do
6
+ describe '#perform' do
7
+ subject(:described_method) { described_class.perform_now(import_file, import_type) }
8
+
9
+ let(:import_file) {}
10
+ let(:import_type) {}
11
+
12
+ it { expect { described_method }.to raise_error(ArgumentError) }
13
+
14
+ context 'with an import file and type' do
15
+ let(:import_file) { solidus_importer_fixture_path('customers.csv') }
16
+ let(:import_type) { :customers }
17
+
18
+ before do
19
+ allow(SolidusImporter::ProcessImport).to receive(:import_from_file)
20
+ described_method
21
+ end
22
+
23
+ it { expect(SolidusImporter::ProcessImport).to have_received(:import_from_file).with(import_file, import_type) }
24
+ end
25
+
26
+ context 'with an existing import model' do
27
+ subject(:described_method) { described_class.perform_now(1) }
28
+
29
+ let(:import) { build(:solidus_importer_import_customers) }
30
+ let(:process_import) { spy }
31
+
32
+ before do
33
+ allow(SolidusImporter::Import).to receive(:find)
34
+ .with(1)
35
+ .and_return(import)
36
+
37
+ allow(SolidusImporter::ProcessImport).to receive(:new)
38
+ .with(import)
39
+ .and_return(process_import)
40
+ end
41
+
42
+ it 'invoke #process on the existing import model' do
43
+ described_method
44
+ expect(process_import).to have_received(:process)
45
+ end
46
+ end
47
+
48
+ context 'when the import model does not exist' do
49
+ subject(:described_method) { described_class.perform_now(1) }
50
+
51
+ it { expect { described_method }.to raise_error(ActiveRecord::RecordNotFound) }
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe SolidusImporter::BaseImporter do
6
+ subject(:described_instance) { described_class.new(options) }
7
+
8
+ let(:options) { {} }
9
+
10
+ describe '#after_import' do
11
+ it { is_expected.to respond_to(:after_import) }
12
+ end
13
+
14
+ describe '#before_import' do
15
+ it { is_expected.to respond_to(:before_import) }
16
+ end
17
+
18
+ describe '#processors' do
19
+ subject(:described_method) { described_instance.processors }
20
+
21
+ it { is_expected.to be_empty }
22
+ end
23
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe SolidusImporter::ProcessImport do
6
+ subject(:described_instance) { described_class.new(import) }
7
+
8
+ describe '#process' do
9
+ subject(:described_method) { described_instance.process }
10
+
11
+ let(:rows_count) { import.rows.size }
12
+
13
+ context 'with a CSV file with invalid headers' do
14
+ let(:rows) { build_list(:solidus_importer_row_customer, 3) }
15
+ let(:import) do
16
+ create(:solidus_importer_import_customers, rows: rows).tap do |import|
17
+ import.import_file = solidus_importer_fixture_path('invalid_headers.csv')
18
+ end
19
+ end
20
+
21
+ it 'fails to import data' do
22
+ expect(described_method.messages).to eq('Invalid headers')
23
+ expect(described_method.state).to eq('failed')
24
+ end
25
+ end
26
+
27
+ context 'with some rows' do
28
+ let(:process_row) { instance_double(::SolidusImporter::ProcessRow, process: nil) }
29
+ let(:rows) { build_list(:solidus_importer_row_customer, 3) }
30
+ let(:import) { create(:solidus_importer_import_customers, rows: rows) }
31
+
32
+ before do
33
+ allow(::SolidusImporter::ProcessRow).to receive_messages(new: process_row)
34
+ described_method
35
+ end
36
+
37
+ it { expect(::SolidusImporter::ProcessRow).to have_received(:new).exactly(rows_count).times }
38
+ end
39
+
40
+ context 'with completed rows' do
41
+ let(:process_row) { instance_double(::SolidusImporter::ProcessRow, process: nil) }
42
+ let(:rows) { build_list(:solidus_importer_row_customer, 3) }
43
+ let!(:import) { create(:solidus_importer_import_customers, rows: rows) }
44
+
45
+ before do
46
+ allow(::SolidusImporter::ProcessRow).to receive_messages(new: process_row)
47
+ import.rows.first.update_column(:state, :completed)
48
+ described_method
49
+ end
50
+
51
+ it { expect(::SolidusImporter::ProcessRow).to have_received(:new).exactly(rows_count - 1).times }
52
+ end
53
+
54
+ context 'with force_scan option' do
55
+ subject(:described_method) { described_instance.process(force_scan: force_scan) }
56
+
57
+ let(:force_scan) { true }
58
+ let(:import) { create(:solidus_importer_import_customers) }
59
+
60
+ before do
61
+ allow(CSV).to receive(:parse).and_call_original
62
+ described_method
63
+ end
64
+
65
+ it { expect(CSV).to have_received(:parse) }
66
+
67
+ context 'without force_scan option' do
68
+ let(:force_scan) { false }
69
+
70
+ it { expect(CSV).not_to have_received(:parse) }
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe SolidusImporter::ProcessRow do
6
+ subject(:described_instance) { described_class.new(importer, row) }
7
+
8
+ let(:importer) {}
9
+ let(:row) {}
10
+
11
+ it { expect { described_instance }.to raise_error(SolidusImporter::Exception, 'No importer defined') }
12
+
13
+ context 'with an importer' do
14
+ let(:importer) { instance_double('AnImporter') }
15
+
16
+ it { expect { described_instance }.to raise_error(SolidusImporter::Exception, 'Invalid row type') }
17
+
18
+ context 'with a row' do
19
+ let(:row) { SolidusImporter::Row.new }
20
+
21
+ it { expect(described_instance).to be_instance_of(described_class) }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe SolidusImporter::Processors::Address do
6
+ describe '#call' do
7
+ subject(:described_method) { described_class.call(context) }
8
+
9
+ let(:context) { { data: data } }
10
+ let(:data) { create(:solidus_importer_row_address, :with_import).data }
11
+ let!(:country) { create :country, iso: 'US' }
12
+ let!(:state) { create :state, abbr: 'WA' }
13
+
14
+ it 'create an address' do
15
+ expect { described_method }.to change(Spree::Address, :count).from(0).to(1)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe SolidusImporter::Processors::Base do
6
+ subject(:described_instance) { described_class.new }
7
+
8
+ it { expect(described_instance.options).to eq({}) }
9
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe SolidusImporter::Processors::Customer do
6
+ describe '#call' do
7
+ subject(:described_method) { described_class.call(context) }
8
+
9
+ let(:context) { {} }
10
+
11
+ context 'without customer email in row data' do
12
+ let(:context) do
13
+ { data: 'Some data' }
14
+ end
15
+
16
+ it 'raises an exception' do
17
+ expect { described_method }.to raise_error(SolidusImporter::Exception, 'Missing required key: "Email"')
18
+ end
19
+ end
20
+
21
+ context 'with invalid fields in row data' do
22
+ let(:context) do
23
+ { data: { 'Email' => '-' } }
24
+ end
25
+
26
+ it 'raises an exception' do
27
+ expect { described_method }.to raise_error(ActiveRecord::RecordInvalid, /Email is invalid/)
28
+ end
29
+ end
30
+
31
+ context 'with a customer row with a file entity' do
32
+ let(:context) do
33
+ { data: build(:solidus_importer_row_customer, :with_import).data }
34
+ end
35
+ let(:result) { context.merge(user: Spree::User.last) }
36
+
37
+ it 'creates a new user' do
38
+ expect { described_method }.to change { Spree::User.count }.by(1)
39
+ expect(described_method).to eq(result)
40
+ end
41
+
42
+ context 'with an existing valid user' do
43
+ let!(:user) { create(:user) }
44
+ let(:result) { context.merge(user: user) }
45
+
46
+ before { allow(Spree::User).to receive(:find_or_initialize_by).and_return(user) }
47
+
48
+ it 'updates the user' do
49
+ expect { described_method }.not_to(change { Spree::User.count })
50
+ expect(described_method).to eq(result)
51
+ end
52
+ end
53
+
54
+ context 'with an existing invalid user' do
55
+ let!(:user) { create(:user).tap { |user| user.password = nil } }
56
+
57
+ before { allow(Spree::User).to receive(:find_or_initialize_by).and_return(user) }
58
+
59
+ it 'raises an exception' do
60
+ expect { described_method }.to raise_error(ActiveRecord::RecordInvalid, /Password can't be blank/)
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe SolidusImporter::Processors::Log do
6
+ describe '#call' do
7
+ subject(:described_method) { described_class.call(context) }
8
+
9
+ let(:context) { {} }
10
+
11
+ before { allow(Spree::LogEntry).to receive(:create!) }
12
+
13
+ it 'creates a log entry' do
14
+ described_method
15
+ expect(Spree::LogEntry).to have_received(:create!)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe SolidusImporter::Processors::OptionTypes do
6
+ describe '#call' do
7
+ subject(:described_method) { described_class.call(context) }
8
+
9
+ let(:context) { { data: data, product: product } }
10
+ let(:product) { create :base_product }
11
+ let(:color) { create :option_type, presentation: 'The color', name: 'Color' }
12
+ let(:size) { create :option_type, presentation: 'The size', name: 'Size' }
13
+ let(:data) do
14
+ {
15
+ 'Option1 Name' => 'Size',
16
+ 'Option2 Name' => 'Color'
17
+ }
18
+ end
19
+
20
+ context 'when "Option(1,2,3) Name" are present' do
21
+ context 'when product already has option types' do
22
+ before { product.option_types << color << size }
23
+
24
+ it 'do not create other option types' do
25
+ expect { described_method }.not_to change(product.option_types, :count)
26
+ end
27
+ end
28
+
29
+ it 'create option types for product in row' do
30
+ expect { described_method }.to change(product.option_types, :count).from(0).to(2)
31
+ expect(product.option_types.first.presentation).to eq 'Size'
32
+ expect(product.option_types.first.name).to eq 'size'
33
+ expect(product.option_types.last.presentation).to eq 'Color'
34
+ expect(product.option_types.last.name).to eq 'color'
35
+ end
36
+ end
37
+ end
38
+ end