csv_import_magic 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/csv_import_magic/importers_controller.rb +49 -6
- data/lib/csv_import_magic/version.rb +1 -1
- data/spec/controllers/csv_import_magic/importers_controller_spec.rb +118 -48
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +58 -5553
- data/spec/dummy/log/test.log +31839 -94831
- data/spec/examples.txt +57 -51
- data/spec/lib/generators/csv_import_magic/install_generator_spec.rb +1 -1
- data/spec/lib/generators/csv_import_magic/rails_5/install_generator_spec.rb +1 -1
- data/spec/rails_helper.rb +1 -0
- metadata +134 -516
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-37276-r4n40q.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-38136-8h3q2p.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-38466-1nr5kco.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-39668-101mi6q.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-40284-81g0ud.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-40408-17a0uvl.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-40523-pj6wl4.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-42084-10luep0.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-42191-11tldaf.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-42321-baundn.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-42420-1qm2isf.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-42570-gywnhk.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-42696-1pg04re.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-42823-vekf7j.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-42910-ewzmcp.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-43235-1fa52ga.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-43323-p159hh.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-45345-1r8v081.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-46182-1dx0tpn.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-46278-fd4m8e.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-46382-9y135a.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-48570-1k4k7t0.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-56058-b7otnp.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-56173-187smu1.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-56280-ax6el0.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-56372-pyd0uc.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-56475-16dw7ov.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-56578-odd4y0.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-56672-l11ojb.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170117-56794-88h4nd.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-10138-13br6m2.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-19400-ra06q5.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-19543-rfxxty.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-19652-1neho6l.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-19786-rxjv36.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-21648-ssn05e.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-23496-ddy2xt.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-30892-1c27rs4.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-30994-qfqs3h.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-32470-1mk1udp.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-32716-13g9myq.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-32807-12b8cgg.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-32901-1vp2axx.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-32992-1jwfjfd.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-33081-1j1d591.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-33180-36l1t8.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-33299-13p8l1x.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-38626-sigf3m.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-38797-1kqkwkw.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-39057-1x8b2fn.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-39157-1087rtq.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-39268-168s29f.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-39355-s8x1si.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-39483-r08bs.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-40181-vdjtbv.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-42041-w1imo1.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-42229-1e22hz4.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-42996-9neptt.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-43889-584l0q.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-44738-ew2i2a.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-7981-1uei1o4.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-8075-15sar1.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-8167-zc1h0z.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-8265-bnndjd.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170118-8364-4u0il1.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170119-56031-votbjp.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170119-56135-j5mcgr.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170119-56240-l2w835.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170119-57815-i1ahvu.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170119-58056-66wtac.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170119-58268-1dty7ny.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170119-63803-1mc7fo4.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170119-74528-duefru.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-81056-63swkp.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-81212-1k8weuv.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-81379-6lpon9.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-82575-1eioq1a.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-84919-1qnjxhv.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-85131-1g8jrl5.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-85343-yezbz5.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-85513-1l2pzgy.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-86070-pwkn99.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-86277-14ckax5.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-86458-1u26pb1.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-86599-q2d5io.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-86739-hfrzzf.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170125-87110-1ky9gnk.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-27355-hl9693.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-27618-1pqa3bs.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-27755-1di5xra.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-27974-cx2o7z.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-28133-1q0tz4z.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-28419-1ia3064.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-28556-veg3ez.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-28784-15yhmp3.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-29002-igofgq.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-29143-1v25x8a.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-29291-1qs4kex.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-29522-5i1a.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-29660-165adk7.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-29945-1lvmnay.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-30103-9qqoc.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-30381-1de3q2.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-30864-1mthr0r.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170126-30993-wxw7ja.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170405-54106-13fpq5g.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170406-92002-8pd0oz.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170406-94335-1j4fnr0.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170602-53937-1jv81f1.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170602-54115-m6aill.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20170602-54234-sjr6h8.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20180330-46149-1h2khva.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20180330-61182-xyg2xk.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20180418-48331-1815bof.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20180418-48464-9motht.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20180605-29207-1708wim.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20191011-46598-1py1uvb.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/failures20200218-84913-ph4lpj.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/002/original/failures20170119-55532-1ujy7xh.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/003/original/failures20170119-87695-1j8psm5.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/003/original/failures20170125-84785-u7rdmo.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/006/original/failures20170118-40447-4jsf3l.csv +0 -2
- data/spec/dummy/public/system/importers/attachment_errors/000/000/007/original/failures20170118-44958-l51x0w.csv +0 -2
- data/spec/dummy/public/system/importers/attachments/000/000/002/original/companies.csv +0 -3
- data/spec/dummy/public/system/importers/attachments/000/000/002/original/companies_invalid.csv +0 -3
- data/spec/dummy/public/system/importers/attachments/000/000/003/original/companies.csv +0 -3
- data/spec/dummy/public/system/importers/attachments/000/000/003/original/companies_invalid.csv +0 -3
- data/spec/dummy/public/system/importers/attachments/000/000/004/original/companies.csv +0 -3
- data/spec/dummy/public/system/importers/attachments/000/000/005/original/companies.csv +0 -3
- data/spec/dummy/public/system/importers/attachments/000/000/006/original/companies_invalid.csv +0 -3
- data/spec/dummy/public/system/importers/attachments/000/000/007/original/companies_invalid.csv +0 -3
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-A/-AzUQ_sdncLrgXJW-mT29l7lXefApIPQNpdCv9ETYkI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/0f/0fmItA1G7uruwRE5HZE9TzG9K4A0NbbxGakdWz0cpDE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2M/2MSWm1oJk8doLU2cxusKHCU78PUDwQ1lrIlu5gXMx_U.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2k/2kXdUd2P4uN67x_E2mUy-AtGn9Fn_h5rQ0PJZi9HzBU.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4b/4bvq3aQAVWrr_CUPXfVFCwfZMnmX-ecl9ZtwAisBlFI.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6-/6-dQ3OmAEd4QXytW4TS1xdUNozHlLKSCawN0oN1oEYw.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/63/63b-SgBWtX-UDgRq-Bsol3W40ijIWiT7uxcHRoVXS-M.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7l/7lUIJIvW1FW_GFVqqnVsKSxpeMaZ3noc0g8Eca5eHhQ.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/9S/9S1VAatjEVICqM1Cojv-CKBUvl0oELWaNfTyFr_S700.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/A9/A9Vpp3VfKYpkCR6f1lAoM4J-w6QQ3fyn3x3TncKXf7U.cache +0 -3
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Av/AvR3LtLvNoPexMzvvUDPuM1V-yuaMddpBdG1RVgQh9Y.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Df/Dfad3HZGzx9mtzeig2tWlnuHQl9vAzoUutfVJwWKC5I.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Dh/DhZ6bJZj4K7QCbNBTmMjFy3HDpC58SqfiPPoCCsAro4.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Hw/HwRNsYmzR0cy4L_V_8SLZiZ9_G6_8E7XiaDV21i9sjA.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/I9/I97QBZ0SyWLebPjfYrwCNlM-Omla1LKRTGiTgmMKi2Q.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/J7/J7Ihmq6t6WbnmJaBScToEb-AR0U1NqHePsGdxAdJoLo.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/KF/KFqlYW7ohx2fJX05v2au1k6Gw7wuzN7UWz2BN90RsAQ.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/LL/LLb4gLbgLgFS-LgcrmKXC--d1IaGB8XM_Yrm48bkwdw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/LX/LXS-BomSubWXJSpkNXCH8m0l2y4sB66BaFb2UuAx14o.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Lq/LqbLgHiwEzXq7mJX3Dtq5XicBULM8CtvDJdv4Ye45ZY.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Nh/Nhtorvc2xM84CWBcqtMIxoqKR4NCkCksOUQ_3UiyegA.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Oy/OyEUtus13InbtOxcvt5WdsbydEkrviBwJXD6z9GQaRA.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/P6/P6-U-RxLXuRTDz8kHA2kBc3jUHSnNlbEHBOnUa97wyY.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Po/Pos0iHsH-rUXDrrdalDi2H6yWVQTcz2ZPyRmQ_RnBPM.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Q1/Q1xmk8Ni14zSYsTX_IvrbX1vbGANki_Udrwx7OBgh9w.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Qo/QogFhnK16HrvDyiH323Z3xlwwofVibvzgZDmBjqh5VQ.cache +0 -3
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/RI/RIagqSB7X-LbJU0ZwntNWf_KMkOm3kCkc7zR57rP1Bc.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/T4/T4WcrrL47jCKFOb5Q1cmn1keh_w3X2OguI_ifzRpS3k.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/TA/TAbsAe1o7EI19gckGhtzbtjqOoSVRRLQrc5n3mnCT28.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/TG/TGe7XAuizvtm9LtzDo5fR7GrEnyWPL8nBr2eESxA0x0.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/V8/V8kjWO7PZcVGI9mBNq17FYWc_muWwcDQF9xWGfnSOjM.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/VV/VVtm8HzHyOByhegKNGl09Ak3sHcSr0e70iHSmy75T6A.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Vb/VbBBjIpX-u1j_Fko8QfFQ61-bfDS8BaYgGATVKIfp3I.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/WR/WRP18y_66NlZHU4W5qM0P1MN8oS5eAlN9UEZrXh3vd0.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Wd/WdUHknjRY-ueTBCEgU4-NzM_BFaTimaeFED6MbFfQLE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/bo/bopbSF0DLQEMLjRvN8Mn4xd-mGx46j9yvENVDA8R9jk.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/e4/e4DrxyTxBlZlpP4PQ0zELpYhl4G2eiBksI0_HwQhrVY.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gZ/gZp3uXMHuYQC4hzCr7bQfetKNdJAtbQmg3so2KpW1Dw.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iK/IKrFvYc5CMyfkKHP7JFW_bS4-tOG1rVwPFcC-OUpENU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iK/IkTLxpKuWrwxrM98yl3Ddv4RjOLzyUS5QHQvZ0Cniv8.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iK/iKpMoxBcOmuavL2xUzgc7LQLnT7EKCaZirHx4KMbdw8.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/je/jeA_WQ150_Af65U1CnVdHsqqZefOHl2ObGMLRQp--sc.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/l1/l1LHMvhocUYdhOc0tOfdy4slQYK2SD4fj6x4mH4wkvI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lo/loI7P5Fiwnq6YZdxqJFAErc6rV61HWRuL5tVaffS3JY.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/m9/m95ShgmvfDO8RuwZpC7gUW0i-FO-k914CWkXd5-LO3I.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/my/myHmSL0lcXz8Mgm5gNVoigImnF7acMaTlwl3z_g2lPM.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oo/oocXRRNDTZPTtm859sgr9TxpBrPby6ND88ROtiCfgSU.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/p-/p-3_4sMWwoC1eQcdH2fmcIdmlxQBFx6evUCdgfgPyKM.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/rn/rnSEYPKQcSZ-D3R7o3aM_1AtiXyLciuL3S3Qa6k_EfI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/sV/sVzlvz069Fh5_GPu0TcrgDBWIHhnwEZ2Rg1AtpEqA9s.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/uV/uVH7RdIENZh9BUaGeb6OUciC9H0hTIKsRpAxXMG5R28.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xQ/xQEI_TWc5k3ouSH2fSRrrWRpsLyeG7QQxmcgPjkwbc8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xQ/xQUUINnLqsr-zxPaIIULgXPE5jh2QtmbdRSYCnhpER4.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xb/xblMCu_z727eCkuWjKJEyre92sVUkcGCpQqGThWe2bk.cache +0 -2
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/yg/ygMyHfDIhhvlowOd5aTDhtXbZCLisqxhDWpdvXd8O5M.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/yg/ygrgsR6-nQLxLaFwAquCXfjIZgUTEoYbI5EFH0KlfW0.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/yh/yh3Aqjs6HjjQubE9-htvIwUg4cFhMRCl7JyBFYBt0xo.cache +0 -1
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/z0/z0QrtOYRAsWOTFYmpCJqXXyGlHxHUxxKBV3_LMxKV2Y.cache +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170119-22243-b3wyrt.csv → failures20250128-67752-1ez8oyv.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170119-22711-1uvny32.csv → failures20250128-68724-15segfl.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170119-82684-glhzzy.csv → failures20250128-69163-1opq74e.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170119-82810-wamt7d.csv → failures20250128-69550-i44guo.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170119-82946-1vdlbhd.csv → failures20250128-70336-1cu62v.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170119-83065-1u153xf.csv → failures20250128-70727-i49nrs.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170119-83165-1c32fyg.csv → failures20250128-71514-1b2w2u9.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170119-84188-1wch9sz.csv → failures20250128-71870-1wuq4jg.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170119-86886-1erfhrx.csv → failures20250128-73039-1ex1enm.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170119-87029-1vof5gs.csv → failures20250128-73415-1np4ev9.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-12481-joulms.csv → failures20250128-73790-9hesri.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-12708-h8hiiu.csv → failures20250128-74458-vf6f5o.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-12804-h1kvkh.csv → failures20250128-74826-x5se9x.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-12985-tjysyw.csv → failures20250128-75204-66mxx0.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-13084-3zodzd.csv → failures20250128-75586-1uja1f0.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-13449-1bpmult.csv → failures20250128-75977-trc5mo.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-13540-2g5zwb.csv → failures20250128-76368-kyy03u.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-15095-wb4mk0.csv → failures20250128-76774-1yoxfoz.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-15202-8ib7ha.csv → failures20250129-18392-ppbkax.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-16523-1s896hk.csv → failures20250207-19058-16t9tfc.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-16637-eboq9e.csv → failures20250207-19634-q550ag.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170120-87818-1j4mz4q.csv → failures20250207-20713-1opayz0.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-65471-17j2vti.csv → failures20250207-23910-ew8ufi.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-65694-1kptcuq.csv → failures20250207-24312-19x1muv.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-66245-crezgc.csv → failures20250207-24712-e71nxw.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-66415-1krzmy1.csv → failures20250207-25135-r1yu2x.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-66524-ndzegu.csv → failures20250207-25541-mhk4rv.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-66655-pjqteu.csv → failures20250213-14365-1fpohny.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-66854-r2dyv2.csv → failures20250213-15178-1d6i5g.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-67000-1t9vfos.csv → failures20250213-15730-lco2qy.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-67391-15d0sso.csv → failures20250213-17482-1gqnk5l.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-67538-1gbudl.csv → failures20250213-17879-13ukdpx.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-67640-p8dmlm.csv → failures20250213-18285-1dd8xy5.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-68349-ziyxe9.csv → failures20250213-18716-zqr2em.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-68617-14k1fap.csv → failures20250213-22025-16nkwn0.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-68815-v1izav.csv → failures20250213-22426-11euw83.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-68984-wcittg.csv → failures20250213-22884-hkkz0z.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-69642-1hi7zb2.csv → failures20250219-54002-111a95b.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-69802-mq57e0.csv → failures20250219-54480-9hhyzq.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-73509-mbxhb6.csv → failures20250219-54900-hsiy6a.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-80682-oask81.csv → failures20250219-55779-1d0g37t.csv} +0 -0
- /data/spec/dummy/public/system/importers/attachment_errors/000/000/001/original/{failures20170125-80872-1vkh6vb.csv → failures20250228-21108-89leci.csv} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1799c22d5a948f93d5013652d3f41332ed0e7d4130ff4ec9331bfed2c3c25010
|
4
|
+
data.tar.gz: fe0b788051da284c8bbe28f5eac7ccdb5dbb52a48d40be91140b8e213dfc27f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75a8feba8f45cc3ff7599311b8b264dc518ba74f2b4a8382d210543a4b7c7a37f889b4762c368c34c713dd96b641f209126c7c4981638855f6766cdc04bbd7ed
|
7
|
+
data.tar.gz: 2738b662407d5c0b80e11442e8a79d7cc743f62e282cc83995e15e510c9197ab837fb7a39b7596fb3f69b7fcb3b2bb3301a439f09bb28aa97460aab9a841da63
|
@@ -2,23 +2,56 @@ module CsvImportMagic
|
|
2
2
|
class ImportersController < CsvImportMagic::BaseController
|
3
3
|
helper_method :import_file_csv
|
4
4
|
layout 'csv_import_magic'
|
5
|
+
respond_to :html, :json
|
5
6
|
|
6
7
|
def show
|
7
8
|
@importer = ::Importer.find(params[:id])
|
9
|
+
|
10
|
+
respond_with do |format|
|
11
|
+
format.html
|
12
|
+
format.json do
|
13
|
+
render json: {
|
14
|
+
importer: @importer,
|
15
|
+
attachment_error_url: @importer&.attachment_error&.url,
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
8
19
|
end
|
9
20
|
|
10
21
|
def create
|
11
22
|
@importer = ::Importer.new(importer_params)
|
12
23
|
|
13
24
|
if @importer.save! && import_file_csv
|
14
|
-
|
25
|
+
respond_with do |format|
|
26
|
+
format.html { redirect_to edit_importer_path(@importer), alert: t('csv_import_magic.importers_controller.create.alert') }
|
27
|
+
format.json do
|
28
|
+
render json: {
|
29
|
+
columns: @importer.importable_columns(@importer.parser).map { |column| [@importer.human_attribute_name(column), column] }.unshift([t('csv_import_magic.views.importers.edit.ignore_column_label'), :ignore]),
|
30
|
+
data: import_file_csv.first(5).map(&:to_hash),
|
31
|
+
importer: @importer
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
15
35
|
end
|
16
36
|
rescue ActiveRecord::RecordInvalid, CSV::MalformedCSVError => e
|
17
|
-
|
37
|
+
respond_with do |format|
|
38
|
+
format.html { redirect_back fallback_location: '/', flash: { error: e.message } }
|
39
|
+
format.json { render json: { error: e.message }, status: :unprocessable_entity }
|
40
|
+
end
|
18
41
|
end
|
19
42
|
|
20
43
|
def edit
|
21
44
|
@importer = ::Importer.find(params[:id])
|
45
|
+
|
46
|
+
respond_with do |format|
|
47
|
+
format.html
|
48
|
+
format.json { render json: @importer }
|
49
|
+
end
|
50
|
+
rescue ActiveRecord::RecordNotFound
|
51
|
+
respond_with do |format|
|
52
|
+
format.html
|
53
|
+
format.json { render json: { error: 'importer not found' }, status: :unprocessable_entity }
|
54
|
+
end
|
22
55
|
end
|
23
56
|
|
24
57
|
def update
|
@@ -26,11 +59,21 @@ module CsvImportMagic
|
|
26
59
|
|
27
60
|
if @importer.update(csv_importer_magic_update_params)
|
28
61
|
CsvImportMagic::ImporterWorker.perform_async(importer_id: @importer.id, resources: resources)
|
29
|
-
|
62
|
+
|
63
|
+
respond_with do |format|
|
64
|
+
format.html { redirect_to importer_path(@importer), flash: { notice: t('csv_import_magic.importers_controller.update.notice') } }
|
65
|
+
format.json { render json: @importer }
|
66
|
+
end
|
30
67
|
else
|
31
68
|
errors = @importer.errors.full_messages.to_sentence
|
32
|
-
|
33
|
-
|
69
|
+
|
70
|
+
respond_with do |format|
|
71
|
+
format.html do
|
72
|
+
flash[:alert] = errors.present? ? errors : t('csv_import_magic.importers_controller.update.alert')
|
73
|
+
render :edit
|
74
|
+
end
|
75
|
+
format.json { render json: { error: errors.present? ? errors : t('csv_import_magic.importers_controller.update.alert') }, status: :unprocessable_entity }
|
76
|
+
end
|
34
77
|
end
|
35
78
|
end
|
36
79
|
|
@@ -60,7 +103,7 @@ module CsvImportMagic
|
|
60
103
|
end
|
61
104
|
|
62
105
|
def importer_params
|
63
|
-
params.require(:importer).permit
|
106
|
+
params.require(:importer).permit(:source, :attachment, :importable_type, :importable_id, :parser)
|
64
107
|
end
|
65
108
|
|
66
109
|
def csv_importer_magic_update_params
|
@@ -4,8 +4,15 @@ RSpec.describe CsvImportMagic::ImportersController, type: :controller do
|
|
4
4
|
routes { CsvImportMagic::Engine.routes }
|
5
5
|
|
6
6
|
describe 'POST #create' do
|
7
|
-
def do_action
|
8
|
-
post :create, params: {
|
7
|
+
def do_action(format = :html)
|
8
|
+
post :create, params: {
|
9
|
+
importer: {
|
10
|
+
attachment: attachment,
|
11
|
+
importable_type: 'User',
|
12
|
+
importable_id: create(:user).id,
|
13
|
+
source: 'company'
|
14
|
+
}
|
15
|
+
}, format: format
|
9
16
|
end
|
10
17
|
|
11
18
|
context 'with valid params' do
|
@@ -15,22 +22,45 @@ RSpec.describe CsvImportMagic::ImportersController, type: :controller do
|
|
15
22
|
expect { do_action }.to change(Importer, :count).by(1)
|
16
23
|
end
|
17
24
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
25
|
+
context 'respond to html' do
|
26
|
+
it 'redirect to edit' do
|
27
|
+
do_action
|
28
|
+
import = Importer.last
|
29
|
+
expect(response).to redirect_to(edit_importer_path(import.id))
|
30
|
+
expect(flash[:alert]).to eq('Por favor, informe em quais colunas podemos encontrar as informações que você deseja.')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'respond to json' do
|
35
|
+
it 'return the importer' do
|
36
|
+
do_action(:json)
|
37
|
+
import = Importer.last
|
38
|
+
expect(response).to be_successful
|
39
|
+
expect(JSON.parse(response.body)).to include('importer' => include('id' => import.id))
|
40
|
+
expect(JSON.parse(response.body)).to include('columns' => include(['Ignorar esta coluna', 'ignore'], ['Nome', 'name'], ['Rua', 'street'], ['Numero', 'number'], ['Bairro', 'neighborhood'], ['Cidade', 'city'], ['Estado', 'state'], ['Pais', 'country']))
|
41
|
+
expect(JSON.parse(response.body)).to include('data' => include(a_hash_including('bairro' => 'Joao de Barro', 'cidade ' => 'Birigui', 'estado ' => 'SP ', 'nome' => 'foo', 'numero' => '1', 'pais' => 'Brasil', 'rua' => 'R: Teste')))
|
42
|
+
end
|
23
43
|
end
|
24
44
|
end
|
25
45
|
|
26
46
|
context 'with invalid params' do
|
27
47
|
let(:attachment) { nil }
|
28
48
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
49
|
+
context 'respond to html' do
|
50
|
+
it 'render to edit with error' do
|
51
|
+
@request.env['HTTP_REFERER'] = 'http://example.com'
|
52
|
+
do_action
|
53
|
+
expect(response).to redirect_to('http://example.com')
|
54
|
+
expect(flash[:error]).to eq('A validação falhou: Anexo CSV não pode ficar em branco')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'respond to json' do
|
59
|
+
it 'return the error' do
|
60
|
+
do_action(:json)
|
61
|
+
expect(response).to have_http_status(:unprocessable_entity)
|
62
|
+
expect(JSON.parse(response.body)).to include('error' => 'A validação falhou: Anexo CSV não pode ficar em branco')
|
63
|
+
end
|
34
64
|
end
|
35
65
|
end
|
36
66
|
end
|
@@ -38,68 +68,108 @@ RSpec.describe CsvImportMagic::ImportersController, type: :controller do
|
|
38
68
|
describe 'GET #show' do
|
39
69
|
let(:importer) { create :importer }
|
40
70
|
|
41
|
-
def do_action
|
42
|
-
get :show, params: { id: importer.id }
|
71
|
+
def do_action(format = :html)
|
72
|
+
get :show, params: { id: importer.id }, format: format
|
43
73
|
end
|
44
74
|
|
45
|
-
|
75
|
+
context 'respond to html' do
|
76
|
+
it 'return OK' do
|
77
|
+
do_action
|
78
|
+
is_expected.to respond_with(:success)
|
79
|
+
is_expected.to render_template(:show)
|
80
|
+
expect(assigns(:importer)).to eq(importer)
|
81
|
+
end
|
82
|
+
end
|
46
83
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
84
|
+
context 'respond to json' do
|
85
|
+
it 'return the importer' do
|
86
|
+
do_action(:json)
|
87
|
+
get :show, params: { id: importer.id }, format: :json
|
88
|
+
expect(response).to be_successful
|
89
|
+
expect(JSON.parse(response.body)).to have_key('importer')
|
90
|
+
expect(JSON.parse(response.body)).to have_key('attachment_error_url')
|
91
|
+
end
|
51
92
|
end
|
52
93
|
end
|
53
94
|
|
54
95
|
describe 'GET #edit' do
|
55
96
|
let(:importer) { create :importer }
|
56
97
|
|
57
|
-
def do_action
|
58
|
-
get :edit, params: { id: importer.id }
|
98
|
+
def do_action(format = :html)
|
99
|
+
get :edit, params: { id: importer.id }, format: format
|
59
100
|
end
|
60
101
|
|
61
|
-
|
102
|
+
context 'respond to html' do
|
103
|
+
it 'return OK' do
|
104
|
+
do_action
|
105
|
+
is_expected.to respond_with(:success)
|
106
|
+
is_expected.to render_template(:edit)
|
107
|
+
expect(assigns(:importer)).to eq(importer)
|
108
|
+
expect(controller.send(:import_file_csv).headers).to match_array(['bairro', 'cidade ', 'cod', 'estado ', 'nome', 'numero', 'pais', 'rua'])
|
109
|
+
end
|
110
|
+
end
|
62
111
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
112
|
+
context 'respond to json' do
|
113
|
+
it 'return the importer' do
|
114
|
+
do_action(:json)
|
115
|
+
expect(response).to be_successful
|
116
|
+
expect(JSON.parse(response.body)).to include('id' => importer.id)
|
117
|
+
end
|
68
118
|
end
|
69
119
|
end
|
70
120
|
|
71
121
|
describe 'PUT #update' do
|
72
122
|
let(:importer) { create :importer, columns: [] }
|
73
123
|
|
74
|
-
def do_action(columns)
|
75
|
-
put :update, params: { id: importer.id, importer: { columns: columns } }
|
124
|
+
def do_action(columns, format = :html)
|
125
|
+
put :update, params: { id: importer.id, importer: { columns: columns } }, format: format
|
76
126
|
end
|
77
127
|
|
78
|
-
context '
|
79
|
-
|
80
|
-
|
81
|
-
|
128
|
+
context 'respond to html' do
|
129
|
+
context 'with valid columns' do
|
130
|
+
it 'update the importer columns list' do
|
131
|
+
do_action(%w(neighborhood city cod state name number country street))
|
132
|
+
expect(importer.reload.columns).to eq(%w(neighborhood city cod state name number country street))
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'redirect back to employees index' do
|
136
|
+
do_action(%w(neighborhood city cod state name number country street))
|
137
|
+
expect(response).to redirect_to(importer_path(importer))
|
138
|
+
expect(flash[:notice]).to eq('Arquivo enviado para processamento.')
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'enqueue the Importer::EmployeesCSVWorker' do
|
142
|
+
expect(CsvImportMagic::ImporterWorker).to receive(:perform_async).with(importer_id: importer.id, resources: nil)
|
143
|
+
do_action(%w(neighborhood city cod state name number country street))
|
144
|
+
end
|
82
145
|
end
|
83
146
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
147
|
+
context 'with invalid columns' do
|
148
|
+
it 'render the edit screen' do
|
149
|
+
do_action(%w(neighborhood city cod state name name number country street))
|
150
|
+
is_expected.to respond_with(:success)
|
151
|
+
is_expected.to render_template(:edit)
|
152
|
+
expect(assigns(:importer)).to eq(importer)
|
153
|
+
expect(flash[:alert]).to eq('Colunas Nome deve ser única')
|
154
|
+
end
|
88
155
|
end
|
156
|
+
end
|
89
157
|
|
90
|
-
|
91
|
-
|
92
|
-
|
158
|
+
context 'respond to json' do
|
159
|
+
context 'with valid columns' do
|
160
|
+
it 'return the importer' do
|
161
|
+
do_action(%w(neighborhood city cod state name number country street), :json)
|
162
|
+
expect(response).to be_successful
|
163
|
+
expect(JSON.parse(response.body)).to include('id' => importer.id)
|
164
|
+
end
|
93
165
|
end
|
94
|
-
end
|
95
166
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
expect(flash[:alert]).to eq('Colunas Nome deve ser única')
|
167
|
+
context 'with invalid columns' do
|
168
|
+
it 'return the error' do
|
169
|
+
do_action(%w(neighborhood city cod state name name number country street), :json)
|
170
|
+
expect(response).to have_http_status(:unprocessable_entity)
|
171
|
+
expect(JSON.parse(response.body)).to include('error' => 'Colunas Nome deve ser única')
|
172
|
+
end
|
103
173
|
end
|
104
174
|
end
|
105
175
|
end
|
Binary file
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|