Advertisement
Guest User

Untitled

a guest
Oct 26th, 2015
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.23 KB | None | 0 0
  1. class ImportCropsterDataJobTest < ActiveJob::TestCase
  2.  
  3. test "create blend batches" do
  4. @blend = FactoryGirl.create(:great_coffee, :blend => true)
  5. @c1 = @blend.blend_coffees.first
  6. @c2 = @blend.blend_coffees.last
  7. @c1.update_attribute(:cropster_id, 1)
  8. @c2.update_attribute(:cropster_id, 2)
  9. @lot_id = 1654109
  10.  
  11. lot_response1 = {"id"=>@c1.cropster_id, "idTag"=>"PR-0166", "name"=>@c1.name, "creationDate"=>1435862801000, "location"=>{"id"=>63874, "name"=>"Roastery"}, "sources"=>[{"lot"=>{"id"=>@lot_id, "name"=>"Kenya Kiangoi"}, "date"=>1435862801000, "weight"=>{"amount"=>12.0, "unit"=>"LBS"}}], "weight"=>{"amount"=>10.4, "unit"=>"LBS"}, "project"=>nil, "certifications"=>[], "initialWeight"=>{"amount"=>10.4, "unit"=>"LBS"}}
  12. lot_response2 = {"id"=>@c2.cropster_id, "idTag"=>"PR-0166", "name"=>@c2.name, "creationDate"=>1435862801000, "location"=>{"id"=>63874, "name"=>"Roastery"}, "sources"=>[{"lot"=>{"id"=>@lot_id, "name"=>"Kenya Kiangoi"}, "date"=>1435862801000, "weight"=>{"amount"=>12.0, "unit"=>"LBS"}}], "weight"=>{"amount"=>10.4, "unit"=>"LBS"}, "project"=>nil, "certifications"=>[], "initialWeight"=>{"amount"=>10.4, "unit"=>"LBS"}}
  13. processing_response1 = {"lot"=>{"id"=>@c1.id, "name"=>@c1.name}, "machine"=>{"id"=>1764, "name"=>"Diedrich IR-12 Elbow Room"}, "profile"=>nil, "worker"=>"Ken", "startDate"=>1435862801000, "endDate"=>1435863404000, "duration"=>603000, "startWeight"=>{"amount"=>12.0, "unit"=>"LBS"}, "endWeight"=>{"amount"=>10.4, "unit"=>"LBS"}, "measures"=>[{"name"=>"roastAreaIndex", "value"=>{"amount"=>50333.18, "unit"=>"FAHRENHEIT"}}, {"name"=>"endTemperature", "value"=>{"amount"=>253.04, "unit"=>"FAHRENHEIT"}}, {"name"=>"developmentTime", "value"=>{"amount"=>106.0, "unit"=>"SECOND"}}, {"name"=>"chargeTemperature", "value"=>{"amount"=>403.16, "unit"=>"FAHRENHEIT"}}, {"name"=>"developmentTimeRatio", "value"=>{"amount"=>17.6, "unit"=>"PERCENT"}}, {"name"=>"ambientTemperature", "value"=>{"amount"=>100.273, "unit"=>"FAHRENHEIT"}}], "comments"=>[{"time"=>79000, "text"=>nil, "event"=>"turningPoint"}, {"time"=>91000, "text"=>"AIRFLOW "}, {"time"=>478000, "text"=>"AIRFLOW "}, {"time"=>497000, "text"=>nil, "event"=>"firstCrack"}], "curves"=>[{"name"=>"gas", "unit"=>"PERCENT", "values"=>{"475000"=>4.0, "545000"=>2.0}}, {"name"=>"beanTemperature", "unit"=>"FAHRENHEIT", "values"=>{"0"=>403.1599999999999, "1000"=>400.46, "2000"=>394.88, "3000"=>387.5, "4000"=>380.84, "5000"=>373.46, "6000"=>366.44, "7000"=>358.88, "8000"=>352.04, "9000"=>345.2, "10000"=>338.36, "11000"=>331.16, "12000"=>324.68, "13000"=>318.2, "14000"=>311.9, "15000"=>306.14, "16000"=>300.02, "17000"=>294.44, "18000"=>288.68, "19000"=>283.46, "20000"=>278.24, "21000"=>273.2, "22000"=>268.16, "23000"=>263.48, "24000"=>259.16, "25000"=>254.66, "26000"=>250.34, "27000"=>246.38, "28000"=>242.42, "29000"=>238.46, "30000"=>234.86, "31000"=>231.26, "32000"=>227.84, "33000"=>224.6, "34000"=>221.54, "35000"=>218.3, "36000"=>215.42, "37000"=>212.72, "38000"=>210.02, "39000"=>207.5, "40000"=>204.62, "41000"=>202.28, "42000"=>199.94, "43000"=>197.78, "44000"=>195.62, "45000"=>193.82, "46000"=>191.84, "47000"=>189.86, "48000"=>188.06, "49000"=>186.44, "50000"=>184.64, "51000"=>183.2, "52000"=>181.76, "53000"=>180.5, "54000"=>179.24, "55000"=>177.98, "56000"=>176.72, "57000"=>175.64, "58000"=>174.38, "59000"=>173.48, "60000"=>172.58, "61000"=>171.68, "62000"=>170.96, "63000"=>170.06, "64000"=>169.34, "65000"=>168.8, "66000"=>168.08, "67000"=>167.72, "68000"=>167.0, "69000"=>166.46, "70000"=>166.1, "71000"=>165.74, "72000"=>165.2, "73000"=>164.84, "74000"=>164.66, "75000"=>164.48, "76000"=>164.3, "77000"=>164.12, "78000"=>164.12, "79000"=>163.58, "80000"=>163.58, "81000"=>163.58, "82000"=>163.58, "83000"=>163.58, "84000"=>163.58, "85000"=>163.94, "86000"=>163.94, "87000"=>164.12, "88000"=>164.3, "89000"=>164.3, "90000"=>164.48, "91000"=>164.66, "92000"=>164.84, "93000"=>165.2, "94000"=>165.56, "95000"=>165.74, "96000"=>166.1, "97000"=>166.46, "98000"=>166.82, "99000"=>167.18, "100000"=>167.72, "101000"=>167.9, "102000"=>168.44, "103000"=>168.8, "104000"=>169.34, "105000"=>169.88, "106000"=>170.42, "107000"=>170.78, "108000"=>171.5, "109000"=>171.86, "110000"=>172.4, "111000"=>173.12, "112000"=>173.48, "113000"=>174.02, "114000"=>174.74, "115000"=>175.28, "116000"=>175.82, "117000"=>176.36, "118000"=>177.08, "119000"=>177.44, "120000"=>178.16, "121000"=>178.52, "122000"=>179.24, "123000"=>179.96, "124000"=>180.5, "125000"=>180.86, "126000"=>181.76, "127000"=>182.48, "128000"=>183.02, "129000"=>183.74, "130000"=>184.64, "131000"=>185.0, "132000"=>185.9, "133000"=>186.44, "134000"=>187.16, "135000"=>187.7, "136000"=>188.6, "137000"=>188.96, "138000"=>189.86, "139000"=>190.4, "140000"=>191.3, "141000"=>192.02, "142000"=>192.56, "143000"=>193.28, "144000"=>193.82, "145000"=>194.72, "146000"=>195.44, "147000"=>195.98, "148000"=>196.7, "149000"=>197.42, "150000"=>197.96, "151000"=>198.68, "152000"=>199.58, "153000"=>200.12, "154000"=>200.84, "155000"=>201.74, "156000"=>202.46, "157000"=>203.0, "158000"=>203.72, "159000"=>204.26, "160000"=>205.16, "161000"=>205.52, "162000"=>206.42, "163000"=>206.96, "164000"=>207.86, "165000"=>208.4, "166000"=>209.12, "167000"=>209.84, "168000"=>210.56, "169000"=>211.28, "170000"=>212.0, "171000"=>212.54, "172000"=>213.44, "173000"=>213.98, "174000"=>214.7, "175000"=>215.24, "176000"=>216.14, "177000"=>216.68, "178000"=>217.4, "179000"=>218.12, "180000"=>218.84, "181000"=>219.38, "182000"=>220.28, "183000"=>220.82, "184000"=>221.36, "185000"=>222.26, "186000"=>222.98, "187000"=>223.52, "188000"=>224.42, "189000"=>224.78, "190000"=>225.5, "191000"=>226.4, "192000"=>226.94, "193000"=>227.66, "194000"=>228.2, "195000"=>228.92, "196000"=>229.64, "197000"=>230.18, "198000"=>230.72, "199000"=>231.44, "200000"=>232.16, "201000"=>232.7, "202000"=>233.24, "203000"=>234.14, "204000"=>234.68, "205000"=>235.4, "206000"=>235.94, "207000"=>236.48, "208000"=>237.38, "209000"=>237.92, "210000"=>238.64, "211000"=>239.36, "212000"=>239.9, "213000"=>240.62, "214000"=>241.34, "215000"=>241.88, "216000"=>242.42, "217000"=>242.96, "218000"=>243.68, "219000"=>244.4, "220000"=>244.94, "221000"=>245.48, "222000"=>246.2, "223000"=>246.56, "224000"=>247.28, "225000"=>248.0, "226000"=>248.54, "227000"=>249.08, "228000"=>249.98, "229000"=>250.34, "230000"=>250.88, "231000"=>251.6, "232000"=>252.14, "233000"=>251.78, "234000"=>253.04, "235000"=>252.5, "239000"=>222.62, "240000"=>220.46, "241000"=>214.7, "242000"=>214.16, "243000"=>212.54, "244000"=>212.18, "245000"=>209.48, "246000"=>212.0, "247000"=>208.94, "248000"=>210.02, "249000"=>208.76, "250000"=>214.88, "251000"=>215.42, "252000"=>214.34, "253000"=>215.06, "254000"=>210.56, "255000"=>212.18, "256000"=>203.36, "257000"=>198.86, "258000"=>190.58, "259000"=>198.68, "260000"=>196.88, "261000"=>196.16, "262000"=>194.0, "263000"=>194.36, "264000"=>192.02, "265000"=>194.0, "266000"=>190.76, "267000"=>191.12, "268000"=>188.6, "269000"=>176.9, "270000"=>187.16, "271000"=>189.68, "272000"=>181.04, "273000"=>185.72, "274000"=>182.3, "275000"=>184.64, "276000"=>180.32, "277000"=>180.68, "278000"=>188.24, "279000"=>187.16, "280000"=>192.2, "281000"=>187.88, "282000"=>188.96, "283000"=>190.22, "284000"=>180.86, "285000"=>184.82, "286000"=>179.6, "287000"=>179.6, "288000"=>184.64, "289000"=>179.96, "290000"=>185.0, "291000"=>185.54, "292000"=>181.94, "293000"=>184.28, "294000"=>182.48, "295000"=>181.58, "296000"=>182.3, "297000"=>180.32, "298000"=>177.44, "299000"=>179.78, "300000"=>179.42, "301000"=>178.34, "302000"=>179.96, "303000"=>179.42, "304000"=>179.42, "305000"=>183.56, "306000"=>188.42, "307000"=>189.14, "308000"=>182.66, "309000"=>189.5, "310000"=>185.18, "311000"=>187.34, "312000"=>186.26, "313000"=>185.72, "314000"=>183.74, "315000"=>185.18, "316000"=>184.46, "317000"=>189.14, "318000"=>188.06, "319000"=>193.64, "320000"=>191.3, "321000"=>197.78, "322000"=>198.14, "323000"=>194.0, "324000"=>195.62, "325000"=>196.88, "326000"=>196.7, "327000"=>192.74, "328000"=>195.26, "329000"=>194.36, "330000"=>195.8, "331000"=>193.1, "332000"=>195.08, "333000"=>194.9, "334000"=>193.64, "335000"=>195.26, "336000"=>193.82, "337000"=>198.68, "338000"=>198.68, "339000"=>197.96, "340000"=>198.68, "341000"=>199.4, "342000"=>199.22, "343000"=>201.92, "344000"=>201.02, "345000"=>199.4, "346000"=>202.82, "347000"=>199.22, "348000"=>201.56, "349000"=>209.12, "350000"=>207.86, "351000"=>211.46, "352000"=>313.16, "353000"=>313.52, "354000"=>313.88, "355000"=>314.24, "356000"=>314.6, "357000"=>315.32, "358000"=>315.68, "359000"=>316.04, "360000"=>316.58, "361000"=>316.94, "362000"=>317.48, "363000"=>317.84, "364000"=>318.2, "365000"=>318.74, "366000"=>319.1, "367000"=>319.64, "368000"=>320.0, "369000"=>320.54, "370000"=>320.9, "371000"=>321.26, "372000"=>321.62, "373000"=>322.16, "374000"=>322.52, "375000"=>322.88, "376000"=>323.42, "377000"=>323.78, "378000"=>324.32, "379000"=>324.68, "380000"=>325.04, "381000"=>325.58, "382000"=>325.94, "383000"=>326.3, "384000"=>326.66, "385000"=>327.38, "386000"=>327.74, "387000"=>328.1, "388000"=>328.46, "389000"=>329.0, "390000"=>329.36, "391000"=>329.54, "392000"=>330.08, "393000"=>330.26, "394000"=>330.98, "395000"=>331.16, "396000"=>331.52, "397000"=>332.06, "398000"=>332.6, "399000"=>332.78, "400000"=>333.14, "401000"=>333.68, "402000"=>333.86, "403000"=>334.4, "404000"=>334.94, "405000"=>335.3, "406000"=>335.66, "407000"=>336.2, "408000"=>336.56, "409000"=>336.92, "410000"=>337.28, "411000"=>337.64, "412000"=>338.18, "413000"=>338.54, "414000"=>338.9, "415000"=>339.26, "416000"=>339.8, "417000"=>340.16, "418000"=>340.52, "419000"=>340.88, "420000"=>341.42, "421000"=>341.78, "422000"=>342.14, "423000"=>342.68, "424000"=>342.86, "425000"=>343.22, "426000"=>343.58, "427000"=>344.12, "428000"=>344.48, "429000"=>344.66, "430000"=>345.2, "431000"=>345.56, "432000"=>345.92, "433000"=>346.1, "434000"=>346.82, "435000"=>347.18, "436000"=>347.54, "437000"=>348.08, "438000"=>348.26, "439000"=>348.62, "440000"=>349.16, "441000"=>349.52, "442000"=>349.88, "443000"=>350.24, "444000"=>350.6, "445000"=>351.14, "446000"=>351.32, "447000"=>351.86, "448000"=>352.04, "449000"=>352.76, "450000"=>352.94, "451000"=>353.3, "452000"=>353.84, "453000"=>354.2, "454000"=>354.56, "455000"=>354.92, "456000"=>355.28, "457000"=>355.82, "458000"=>356.18, "459000"=>356.54, "460000"=>356.9, "461000"=>357.44, "462000"=>357.62, "463000"=>357.98, "464000"=>358.52, "465000"=>359.06, "466000"=>359.24, "467000"=>359.6, "468000"=>359.96, "469000"=>360.5, "470000"=>360.86, "471000"=>361.22, "472000"=>361.76, "473000"=>362.12, "474000"=>362.48, "475000"=>362.84, "476000"=>363.2, "477000"=>363.74, "478000"=>364.1, "479000"=>364.46, "480000"=>364.82, "481000"=>365.36, "482000"=>365.72, "483000"=>366.08, "484000"=>366.62, "485000"=>366.8, "486000"=>367.16, "487000"=>367.7, "488000"=>368.06, "489000"=>368.42, "490000"=>368.78, "491000"=>369.32, "492000"=>369.68, "493000"=>370.04, "494000"=>370.58, "495000"=>370.94, "496000"=>371.3, "497000"=>371.66, "498000"=>372.2, "499000"=>372.38, "500000"=>372.92, "501000"=>373.1, "502000"=>373.64, "503000"=>374.0, "504000"=>374.54, "505000"=>374.9, "506000"=>375.26, "507000"=>375.44, "508000"=>376.16, "509000"=>376.34, "510000"=>376.7, "511000"=>377.06, "512000"=>377.42, "513000"=>377.96, "514000"=>378.5, "515000"=>378.68, "516000"=>379.04, "517000"=>379.58, "518000"=>379.94, "519000"=>380.3, "520000"=>380.66, "521000"=>381.2, "522000"=>381.56, "523000"=>381.92, "524000"=>382.28, "525000"=>382.64, "526000"=>383.0, "527000"=>383.36, "528000"=>383.72, "529000"=>383.9, "530000"=>384.44, "531000"=>384.62, "532000"=>384.98, "533000"=>385.34, "534000"=>385.7, "535000"=>386.06, "536000"=>386.6, "537000"=>386.78, "538000"=>386.96, "539000"=>387.14, "540000"=>387.5, "541000"=>387.68, "542000"=>388.04, "543000"=>388.22, "544000"=>388.76, "545000"=>388.94, "546000"=>389.12, "547000"=>389.3, "548000"=>389.48, "549000"=>389.66, "550000"=>389.84, "551000"=>390.2, "552000"=>390.38, "553000"=>390.56, "554000"=>390.92, "555000"=>390.92, "556000"=>391.1, "557000"=>391.28, "558000"=>391.46, "559000"=>391.64, "560000"=>392.0, "561000"=>392.18, "562000"=>392.36, "563000"=>392.54, "564000"=>392.54, "565000"=>392.72, "566000"=>392.9, "567000"=>392.9, "568000"=>393.08, "569000"=>393.26, "570000"=>393.26, "571000"=>393.44, "572000"=>393.44, "573000"=>393.8, "574000"=>393.8, "575000"=>393.98, "576000"=>394.16, "577000"=>394.16, "578000"=>394.34, "579000"=>394.52, "580000"=>394.52, "581000"=>394.7, "582000"=>394.88, "583000"=>394.88, "584000"=>395.06, "585000"=>395.24, "586000"=>395.24, "587000"=>395.6, "588000"=>395.6, "589000"=>395.78, "590000"=>395.78, "591000"=>395.96, "592000"=>395.96, "593000"=>396.32, "594000"=>396.32, "595000"=>396.5, "596000"=>396.68, "597000"=>396.68, "598000"=>396.86, "599000"=>396.86, "600000"=>397.04, "601000"=>397.4, "602000"=>397.4, "603000"=>397.58}}], "notes"=>""}
  14. processing_response2 = {"lot"=>{"id"=>@c2.id, "name"=>@c2.name}, "machine"=>{"id"=>1764, "name"=>"Diedrich IR-12 Elbow Room"}, "profile"=>nil, "worker"=>"Ken", "startDate"=>1435862801000, "endDate"=>1435863404000, "duration"=>603000, "startWeight"=>{"amount"=>12.0, "unit"=>"LBS"}, "endWeight"=>{"amount"=>10.4, "unit"=>"LBS"}, "measures"=>[{"name"=>"roastAreaIndex", "value"=>{"amount"=>50333.18, "unit"=>"FAHRENHEIT"}}, {"name"=>"endTemperature", "value"=>{"amount"=>253.04, "unit"=>"FAHRENHEIT"}}, {"name"=>"developmentTime", "value"=>{"amount"=>106.0, "unit"=>"SECOND"}}, {"name"=>"chargeTemperature", "value"=>{"amount"=>403.16, "unit"=>"FAHRENHEIT"}}, {"name"=>"developmentTimeRatio", "value"=>{"amount"=>17.6, "unit"=>"PERCENT"}}, {"name"=>"ambientTemperature", "value"=>{"amount"=>100.273, "unit"=>"FAHRENHEIT"}}], "comments"=>[{"time"=>79000, "text"=>nil, "event"=>"turningPoint"}, {"time"=>91000, "text"=>"AIRFLOW "}, {"time"=>478000, "text"=>"AIRFLOW "}, {"time"=>497000, "text"=>nil, "event"=>"firstCrack"}], "curves"=>[{"name"=>"gas", "unit"=>"PERCENT", "values"=>{"475000"=>4.0, "545000"=>2.0}}, {"name"=>"beanTemperature", "unit"=>"FAHRENHEIT", "values"=>{"0"=>403.1599999999999, "1000"=>400.46, "2000"=>394.88, "3000"=>387.5, "4000"=>380.84, "5000"=>373.46, "6000"=>366.44, "7000"=>358.88, "8000"=>352.04, "9000"=>345.2, "10000"=>338.36, "11000"=>331.16, "12000"=>324.68, "13000"=>318.2, "14000"=>311.9, "15000"=>306.14, "16000"=>300.02, "17000"=>294.44, "18000"=>288.68, "19000"=>283.46, "20000"=>278.24, "21000"=>273.2, "22000"=>268.16, "23000"=>263.48, "24000"=>259.16, "25000"=>254.66, "26000"=>250.34, "27000"=>246.38, "28000"=>242.42, "29000"=>238.46, "30000"=>234.86, "31000"=>231.26, "32000"=>227.84, "33000"=>224.6, "34000"=>221.54, "35000"=>218.3, "36000"=>215.42, "37000"=>212.72, "38000"=>210.02, "39000"=>207.5, "40000"=>204.62, "41000"=>202.28, "42000"=>199.94, "43000"=>197.78, "44000"=>195.62, "45000"=>193.82, "46000"=>191.84, "47000"=>189.86, "48000"=>188.06, "49000"=>186.44, "50000"=>184.64, "51000"=>183.2, "52000"=>181.76, "53000"=>180.5, "54000"=>179.24, "55000"=>177.98, "56000"=>176.72, "57000"=>175.64, "58000"=>174.38, "59000"=>173.48, "60000"=>172.58, "61000"=>171.68, "62000"=>170.96, "63000"=>170.06, "64000"=>169.34, "65000"=>168.8, "66000"=>168.08, "67000"=>167.72, "68000"=>167.0, "69000"=>166.46, "70000"=>166.1, "71000"=>165.74, "72000"=>165.2, "73000"=>164.84, "74000"=>164.66, "75000"=>164.48, "76000"=>164.3, "77000"=>164.12, "78000"=>164.12, "79000"=>163.58, "80000"=>163.58, "81000"=>163.58, "82000"=>163.58, "83000"=>163.58, "84000"=>163.58, "85000"=>163.94, "86000"=>163.94, "87000"=>164.12, "88000"=>164.3, "89000"=>164.3, "90000"=>164.48, "91000"=>164.66, "92000"=>164.84, "93000"=>165.2, "94000"=>165.56, "95000"=>165.74, "96000"=>166.1, "97000"=>166.46, "98000"=>166.82, "99000"=>167.18, "100000"=>167.72, "101000"=>167.9, "102000"=>168.44, "103000"=>168.8, "104000"=>169.34, "105000"=>169.88, "106000"=>170.42, "107000"=>170.78, "108000"=>171.5, "109000"=>171.86, "110000"=>172.4, "111000"=>173.12, "112000"=>173.48, "113000"=>174.02, "114000"=>174.74, "115000"=>175.28, "116000"=>175.82, "117000"=>176.36, "118000"=>177.08, "119000"=>177.44, "120000"=>178.16, "121000"=>178.52, "122000"=>179.24, "123000"=>179.96, "124000"=>180.5, "125000"=>180.86, "126000"=>181.76, "127000"=>182.48, "128000"=>183.02, "129000"=>183.74, "130000"=>184.64, "131000"=>185.0, "132000"=>185.9, "133000"=>186.44, "134000"=>187.16, "135000"=>187.7, "136000"=>188.6, "137000"=>188.96, "138000"=>189.86, "139000"=>190.4, "140000"=>191.3, "141000"=>192.02, "142000"=>192.56, "143000"=>193.28, "144000"=>193.82, "145000"=>194.72, "146000"=>195.44, "147000"=>195.98, "148000"=>196.7, "149000"=>197.42, "150000"=>197.96, "151000"=>198.68, "152000"=>199.58, "153000"=>200.12, "154000"=>200.84, "155000"=>201.74, "156000"=>202.46, "157000"=>203.0, "158000"=>203.72, "159000"=>204.26, "160000"=>205.16, "161000"=>205.52, "162000"=>206.42, "163000"=>206.96, "164000"=>207.86, "165000"=>208.4, "166000"=>209.12, "167000"=>209.84, "168000"=>210.56, "169000"=>211.28, "170000"=>212.0, "171000"=>212.54, "172000"=>213.44, "173000"=>213.98, "174000"=>214.7, "175000"=>215.24, "176000"=>216.14, "177000"=>216.68, "178000"=>217.4, "179000"=>218.12, "180000"=>218.84, "181000"=>219.38, "182000"=>220.28, "183000"=>220.82, "184000"=>221.36, "185000"=>222.26, "186000"=>222.98, "187000"=>223.52, "188000"=>224.42, "189000"=>224.78, "190000"=>225.5, "191000"=>226.4, "192000"=>226.94, "193000"=>227.66, "194000"=>228.2, "195000"=>228.92, "196000"=>229.64, "197000"=>230.18, "198000"=>230.72, "199000"=>231.44, "200000"=>232.16, "201000"=>232.7, "202000"=>233.24, "203000"=>234.14, "204000"=>234.68, "205000"=>235.4, "206000"=>235.94, "207000"=>236.48, "208000"=>237.38, "209000"=>237.92, "210000"=>238.64, "211000"=>239.36, "212000"=>239.9, "213000"=>240.62, "214000"=>241.34, "215000"=>241.88, "216000"=>242.42, "217000"=>242.96, "218000"=>243.68, "219000"=>244.4, "220000"=>244.94, "221000"=>245.48, "222000"=>246.2, "223000"=>246.56, "224000"=>247.28, "225000"=>248.0, "226000"=>248.54, "227000"=>249.08, "228000"=>249.98, "229000"=>250.34, "230000"=>250.88, "231000"=>251.6, "232000"=>252.14, "233000"=>251.78, "234000"=>253.04, "235000"=>252.5, "239000"=>222.62, "240000"=>220.46, "241000"=>214.7, "242000"=>214.16, "243000"=>212.54, "244000"=>212.18, "245000"=>209.48, "246000"=>212.0, "247000"=>208.94, "248000"=>210.02, "249000"=>208.76, "250000"=>214.88, "251000"=>215.42, "252000"=>214.34, "253000"=>215.06, "254000"=>210.56, "255000"=>212.18, "256000"=>203.36, "257000"=>198.86, "258000"=>190.58, "259000"=>198.68, "260000"=>196.88, "261000"=>196.16, "262000"=>194.0, "263000"=>194.36, "264000"=>192.02, "265000"=>194.0, "266000"=>190.76, "267000"=>191.12, "268000"=>188.6, "269000"=>176.9, "270000"=>187.16, "271000"=>189.68, "272000"=>181.04, "273000"=>185.72, "274000"=>182.3, "275000"=>184.64, "276000"=>180.32, "277000"=>180.68, "278000"=>188.24, "279000"=>187.16, "280000"=>192.2, "281000"=>187.88, "282000"=>188.96, "283000"=>190.22, "284000"=>180.86, "285000"=>184.82, "286000"=>179.6, "287000"=>179.6, "288000"=>184.64, "289000"=>179.96, "290000"=>185.0, "291000"=>185.54, "292000"=>181.94, "293000"=>184.28, "294000"=>182.48, "295000"=>181.58, "296000"=>182.3, "297000"=>180.32, "298000"=>177.44, "299000"=>179.78, "300000"=>179.42, "301000"=>178.34, "302000"=>179.96, "303000"=>179.42, "304000"=>179.42, "305000"=>183.56, "306000"=>188.42, "307000"=>189.14, "308000"=>182.66, "309000"=>189.5, "310000"=>185.18, "311000"=>187.34, "312000"=>186.26, "313000"=>185.72, "314000"=>183.74, "315000"=>185.18, "316000"=>184.46, "317000"=>189.14, "318000"=>188.06, "319000"=>193.64, "320000"=>191.3, "321000"=>197.78, "322000"=>198.14, "323000"=>194.0, "324000"=>195.62, "325000"=>196.88, "326000"=>196.7, "327000"=>192.74, "328000"=>195.26, "329000"=>194.36, "330000"=>195.8, "331000"=>193.1, "332000"=>195.08, "333000"=>194.9, "334000"=>193.64, "335000"=>195.26, "336000"=>193.82, "337000"=>198.68, "338000"=>198.68, "339000"=>197.96, "340000"=>198.68, "341000"=>199.4, "342000"=>199.22, "343000"=>201.92, "344000"=>201.02, "345000"=>199.4, "346000"=>202.82, "347000"=>199.22, "348000"=>201.56, "349000"=>209.12, "350000"=>207.86, "351000"=>211.46, "352000"=>313.16, "353000"=>313.52, "354000"=>313.88, "355000"=>314.24, "356000"=>314.6, "357000"=>315.32, "358000"=>315.68, "359000"=>316.04, "360000"=>316.58, "361000"=>316.94, "362000"=>317.48, "363000"=>317.84, "364000"=>318.2, "365000"=>318.74, "366000"=>319.1, "367000"=>319.64, "368000"=>320.0, "369000"=>320.54, "370000"=>320.9, "371000"=>321.26, "372000"=>321.62, "373000"=>322.16, "374000"=>322.52, "375000"=>322.88, "376000"=>323.42, "377000"=>323.78, "378000"=>324.32, "379000"=>324.68, "380000"=>325.04, "381000"=>325.58, "382000"=>325.94, "383000"=>326.3, "384000"=>326.66, "385000"=>327.38, "386000"=>327.74, "387000"=>328.1, "388000"=>328.46, "389000"=>329.0, "390000"=>329.36, "391000"=>329.54, "392000"=>330.08, "393000"=>330.26, "394000"=>330.98, "395000"=>331.16, "396000"=>331.52, "397000"=>332.06, "398000"=>332.6, "399000"=>332.78, "400000"=>333.14, "401000"=>333.68, "402000"=>333.86, "403000"=>334.4, "404000"=>334.94, "405000"=>335.3, "406000"=>335.66, "407000"=>336.2, "408000"=>336.56, "409000"=>336.92, "410000"=>337.28, "411000"=>337.64, "412000"=>338.18, "413000"=>338.54, "414000"=>338.9, "415000"=>339.26, "416000"=>339.8, "417000"=>340.16, "418000"=>340.52, "419000"=>340.88, "420000"=>341.42, "421000"=>341.78, "422000"=>342.14, "423000"=>342.68, "424000"=>342.86, "425000"=>343.22, "426000"=>343.58, "427000"=>344.12, "428000"=>344.48, "429000"=>344.66, "430000"=>345.2, "431000"=>345.56, "432000"=>345.92, "433000"=>346.1, "434000"=>346.82, "435000"=>347.18, "436000"=>347.54, "437000"=>348.08, "438000"=>348.26, "439000"=>348.62, "440000"=>349.16, "441000"=>349.52, "442000"=>349.88, "443000"=>350.24, "444000"=>350.6, "445000"=>351.14, "446000"=>351.32, "447000"=>351.86, "448000"=>352.04, "449000"=>352.76, "450000"=>352.94, "451000"=>353.3, "452000"=>353.84, "453000"=>354.2, "454000"=>354.56, "455000"=>354.92, "456000"=>355.28, "457000"=>355.82, "458000"=>356.18, "459000"=>356.54, "460000"=>356.9, "461000"=>357.44, "462000"=>357.62, "463000"=>357.98, "464000"=>358.52, "465000"=>359.06, "466000"=>359.24, "467000"=>359.6, "468000"=>359.96, "469000"=>360.5, "470000"=>360.86, "471000"=>361.22, "472000"=>361.76, "473000"=>362.12, "474000"=>362.48, "475000"=>362.84, "476000"=>363.2, "477000"=>363.74, "478000"=>364.1, "479000"=>364.46, "480000"=>364.82, "481000"=>365.36, "482000"=>365.72, "483000"=>366.08, "484000"=>366.62, "485000"=>366.8, "486000"=>367.16, "487000"=>367.7, "488000"=>368.06, "489000"=>368.42, "490000"=>368.78, "491000"=>369.32, "492000"=>369.68, "493000"=>370.04, "494000"=>370.58, "495000"=>370.94, "496000"=>371.3, "497000"=>371.66, "498000"=>372.2, "499000"=>372.38, "500000"=>372.92, "501000"=>373.1, "502000"=>373.64, "503000"=>374.0, "504000"=>374.54, "505000"=>374.9, "506000"=>375.26, "507000"=>375.44, "508000"=>376.16, "509000"=>376.34, "510000"=>376.7, "511000"=>377.06, "512000"=>377.42, "513000"=>377.96, "514000"=>378.5, "515000"=>378.68, "516000"=>379.04, "517000"=>379.58, "518000"=>379.94, "519000"=>380.3, "520000"=>380.66, "521000"=>381.2, "522000"=>381.56, "523000"=>381.92, "524000"=>382.28, "525000"=>382.64, "526000"=>383.0, "527000"=>383.36, "528000"=>383.72, "529000"=>383.9, "530000"=>384.44, "531000"=>384.62, "532000"=>384.98, "533000"=>385.34, "534000"=>385.7, "535000"=>386.06, "536000"=>386.6, "537000"=>386.78, "538000"=>386.96, "539000"=>387.14, "540000"=>387.5, "541000"=>387.68, "542000"=>388.04, "543000"=>388.22, "544000"=>388.76, "545000"=>388.94, "546000"=>389.12, "547000"=>389.3, "548000"=>389.48, "549000"=>389.66, "550000"=>389.84, "551000"=>390.2, "552000"=>390.38, "553000"=>390.56, "554000"=>390.92, "555000"=>390.92, "556000"=>391.1, "557000"=>391.28, "558000"=>391.46, "559000"=>391.64, "560000"=>392.0, "561000"=>392.18, "562000"=>392.36, "563000"=>392.54, "564000"=>392.54, "565000"=>392.72, "566000"=>392.9, "567000"=>392.9, "568000"=>393.08, "569000"=>393.26, "570000"=>393.26, "571000"=>393.44, "572000"=>393.44, "573000"=>393.8, "574000"=>393.8, "575000"=>393.98, "576000"=>394.16, "577000"=>394.16, "578000"=>394.34, "579000"=>394.52, "580000"=>394.52, "581000"=>394.7, "582000"=>394.88, "583000"=>394.88, "584000"=>395.06, "585000"=>395.24, "586000"=>395.24, "587000"=>395.6, "588000"=>395.6, "589000"=>395.78, "590000"=>395.78, "591000"=>395.96, "592000"=>395.96, "593000"=>396.32, "594000"=>396.32, "595000"=>396.5, "596000"=>396.68, "597000"=>396.68, "598000"=>396.86, "599000"=>396.86, "600000"=>397.04, "601000"=>397.4, "602000"=>397.4, "603000"=>397.58}}], "notes"=>""}
  15.  
  16. Cropster::Transaction.stubs({:get_response => {
  17. :body => [
  18. {"id"=>3049866, "type"=>"coffee.roasting", "date"=>1435862801000, "weight"=>{"amount"=>12.0, "unit"=>"LBS"}, "source"=>{"id"=>@c1.id, "name"=>"Kenya Kiangoi"}, "destination"=>{"id"=>1752826, "name"=>"Kenya Kiangoi"}},
  19. {"id"=>3049866, "type"=>"coffee.roasting", "date"=>1435862801000, "weight"=>{"amount"=>12.0, "unit"=>"LBS"}, "source"=>{"id"=>@c2.id, "name"=>"Kenya Kiangoi"}, "destination"=>{"id"=>1752826, "name"=>"Kenya Kiangoi"}}
  20. ]
  21. }})
  22.  
  23. # Cropster::Lot.stubs({:find => lot_response})
  24. def Cropster::Lot.find(id)
  25. [lot_response1, lot_response2].detect{ |item| item['id'] == id }
  26. end
  27.  
  28. # Cropster::Processing.stubs(:find => processing_response)
  29. def Cropster::Processing.find(id)
  30. [processing_response1, processing_response2].detect{ |item| item['source']['id'] == id }
  31. end
  32.  
  33. assert_difference "Batch.find_blends.count" do
  34. assert_difference "Batch.count", 3 do
  35. ImportCropsterDataJob.perform_now({})
  36. end
  37. end
  38. end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement