spree_frontend 2.4.10 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (378) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -0
  3. data/Gemfile +6 -0
  4. data/LICENSE +1 -1
  5. data/README.md +39 -10
  6. data/Rakefile +29 -0
  7. data/{vendor → app}/assets/images/flags/ad.png +0 -0
  8. data/{vendor → app}/assets/images/flags/ae.png +0 -0
  9. data/{vendor → app}/assets/images/flags/af.png +0 -0
  10. data/{vendor → app}/assets/images/flags/ag.png +0 -0
  11. data/{vendor → app}/assets/images/flags/ai.png +0 -0
  12. data/{vendor → app}/assets/images/flags/al.png +0 -0
  13. data/{vendor → app}/assets/images/flags/am.png +0 -0
  14. data/{vendor → app}/assets/images/flags/an.png +0 -0
  15. data/{vendor → app}/assets/images/flags/ao.png +0 -0
  16. data/{vendor → app}/assets/images/flags/ar.png +0 -0
  17. data/{vendor → app}/assets/images/flags/as.png +0 -0
  18. data/{vendor → app}/assets/images/flags/at.png +0 -0
  19. data/{vendor → app}/assets/images/flags/au.png +0 -0
  20. data/{vendor → app}/assets/images/flags/aw.png +0 -0
  21. data/{vendor → app}/assets/images/flags/ax.png +0 -0
  22. data/{vendor → app}/assets/images/flags/az.png +0 -0
  23. data/{vendor → app}/assets/images/flags/ba.png +0 -0
  24. data/{vendor → app}/assets/images/flags/bb.png +0 -0
  25. data/{vendor → app}/assets/images/flags/bd.png +0 -0
  26. data/{vendor → app}/assets/images/flags/be.png +0 -0
  27. data/{vendor → app}/assets/images/flags/bf.png +0 -0
  28. data/{vendor → app}/assets/images/flags/bg.png +0 -0
  29. data/{vendor → app}/assets/images/flags/bh.png +0 -0
  30. data/{vendor → app}/assets/images/flags/bi.png +0 -0
  31. data/{vendor → app}/assets/images/flags/bj.png +0 -0
  32. data/{vendor → app}/assets/images/flags/bm.png +0 -0
  33. data/{vendor → app}/assets/images/flags/bn.png +0 -0
  34. data/{vendor → app}/assets/images/flags/bo.png +0 -0
  35. data/{vendor → app}/assets/images/flags/br.png +0 -0
  36. data/{vendor → app}/assets/images/flags/bs.png +0 -0
  37. data/{vendor → app}/assets/images/flags/bt.png +0 -0
  38. data/{vendor → app}/assets/images/flags/bv.png +0 -0
  39. data/{vendor → app}/assets/images/flags/bw.png +0 -0
  40. data/{vendor → app}/assets/images/flags/by.png +0 -0
  41. data/{vendor → app}/assets/images/flags/bz.png +0 -0
  42. data/{vendor → app}/assets/images/flags/ca.png +0 -0
  43. data/{vendor → app}/assets/images/flags/catalonia.png +0 -0
  44. data/{vendor → app}/assets/images/flags/cc.png +0 -0
  45. data/{vendor → app}/assets/images/flags/cd.png +0 -0
  46. data/{vendor → app}/assets/images/flags/cf.png +0 -0
  47. data/{vendor → app}/assets/images/flags/cg.png +0 -0
  48. data/{vendor → app}/assets/images/flags/ch.png +0 -0
  49. data/{vendor → app}/assets/images/flags/ci.png +0 -0
  50. data/{vendor → app}/assets/images/flags/ck.png +0 -0
  51. data/{vendor → app}/assets/images/flags/cl.png +0 -0
  52. data/{vendor → app}/assets/images/flags/cm.png +0 -0
  53. data/{vendor → app}/assets/images/flags/cn.png +0 -0
  54. data/{vendor → app}/assets/images/flags/co.png +0 -0
  55. data/{vendor → app}/assets/images/flags/cr.png +0 -0
  56. data/{vendor → app}/assets/images/flags/cs.png +0 -0
  57. data/{vendor → app}/assets/images/flags/cu.png +0 -0
  58. data/{vendor → app}/assets/images/flags/cv.png +0 -0
  59. data/{vendor → app}/assets/images/flags/cx.png +0 -0
  60. data/{vendor → app}/assets/images/flags/cy.png +0 -0
  61. data/{vendor → app}/assets/images/flags/cz.png +0 -0
  62. data/{vendor → app}/assets/images/flags/de.png +0 -0
  63. data/{vendor → app}/assets/images/flags/dj.png +0 -0
  64. data/{vendor → app}/assets/images/flags/dk.png +0 -0
  65. data/{vendor → app}/assets/images/flags/dm.png +0 -0
  66. data/{vendor → app}/assets/images/flags/do.png +0 -0
  67. data/{vendor → app}/assets/images/flags/dz.png +0 -0
  68. data/{vendor → app}/assets/images/flags/ec.png +0 -0
  69. data/{vendor → app}/assets/images/flags/ee.png +0 -0
  70. data/{vendor → app}/assets/images/flags/eg.png +0 -0
  71. data/{vendor → app}/assets/images/flags/eh.png +0 -0
  72. data/{vendor → app}/assets/images/flags/england.png +0 -0
  73. data/{vendor → app}/assets/images/flags/er.png +0 -0
  74. data/{vendor → app}/assets/images/flags/es.png +0 -0
  75. data/{vendor → app}/assets/images/flags/et.png +0 -0
  76. data/{vendor → app}/assets/images/flags/europeanunion.png +0 -0
  77. data/{vendor → app}/assets/images/flags/fam.png +0 -0
  78. data/{vendor → app}/assets/images/flags/fi.png +0 -0
  79. data/{vendor → app}/assets/images/flags/fj.png +0 -0
  80. data/{vendor → app}/assets/images/flags/fk.png +0 -0
  81. data/{vendor → app}/assets/images/flags/fm.png +0 -0
  82. data/{vendor → app}/assets/images/flags/fo.png +0 -0
  83. data/{vendor → app}/assets/images/flags/fr.png +0 -0
  84. data/{vendor → app}/assets/images/flags/ga.png +0 -0
  85. data/{vendor → app}/assets/images/flags/gb.png +0 -0
  86. data/{vendor → app}/assets/images/flags/gd.png +0 -0
  87. data/{vendor → app}/assets/images/flags/ge.png +0 -0
  88. data/{vendor → app}/assets/images/flags/gf.png +0 -0
  89. data/{vendor → app}/assets/images/flags/gh.png +0 -0
  90. data/{vendor → app}/assets/images/flags/gi.png +0 -0
  91. data/{vendor → app}/assets/images/flags/gl.png +0 -0
  92. data/{vendor → app}/assets/images/flags/gm.png +0 -0
  93. data/{vendor → app}/assets/images/flags/gn.png +0 -0
  94. data/{vendor → app}/assets/images/flags/gp.png +0 -0
  95. data/{vendor → app}/assets/images/flags/gq.png +0 -0
  96. data/{vendor → app}/assets/images/flags/gr.png +0 -0
  97. data/{vendor → app}/assets/images/flags/gs.png +0 -0
  98. data/{vendor → app}/assets/images/flags/gt.png +0 -0
  99. data/{vendor → app}/assets/images/flags/gu.png +0 -0
  100. data/{vendor → app}/assets/images/flags/gw.png +0 -0
  101. data/{vendor → app}/assets/images/flags/gy.png +0 -0
  102. data/{vendor → app}/assets/images/flags/hk.png +0 -0
  103. data/{vendor → app}/assets/images/flags/hm.png +0 -0
  104. data/{vendor → app}/assets/images/flags/hn.png +0 -0
  105. data/{vendor → app}/assets/images/flags/hr.png +0 -0
  106. data/{vendor → app}/assets/images/flags/ht.png +0 -0
  107. data/{vendor → app}/assets/images/flags/hu.png +0 -0
  108. data/{vendor → app}/assets/images/flags/id.png +0 -0
  109. data/{vendor → app}/assets/images/flags/ie.png +0 -0
  110. data/{vendor → app}/assets/images/flags/il.png +0 -0
  111. data/{vendor → app}/assets/images/flags/in.png +0 -0
  112. data/{vendor → app}/assets/images/flags/io.png +0 -0
  113. data/{vendor → app}/assets/images/flags/iq.png +0 -0
  114. data/{vendor → app}/assets/images/flags/ir.png +0 -0
  115. data/{vendor → app}/assets/images/flags/is.png +0 -0
  116. data/{vendor → app}/assets/images/flags/it.png +0 -0
  117. data/{vendor → app}/assets/images/flags/ja.png +0 -0
  118. data/{vendor → app}/assets/images/flags/jm.png +0 -0
  119. data/{vendor → app}/assets/images/flags/jo.png +0 -0
  120. data/{vendor → app}/assets/images/flags/ke.png +0 -0
  121. data/{vendor → app}/assets/images/flags/kg.png +0 -0
  122. data/{vendor → app}/assets/images/flags/kh.png +0 -0
  123. data/{vendor → app}/assets/images/flags/ki.png +0 -0
  124. data/{vendor → app}/assets/images/flags/km.png +0 -0
  125. data/{vendor → app}/assets/images/flags/kn.png +0 -0
  126. data/{vendor → app}/assets/images/flags/kp.png +0 -0
  127. data/{vendor → app}/assets/images/flags/kr.png +0 -0
  128. data/{vendor → app}/assets/images/flags/kw.png +0 -0
  129. data/{vendor → app}/assets/images/flags/ky.png +0 -0
  130. data/{vendor → app}/assets/images/flags/kz.png +0 -0
  131. data/{vendor → app}/assets/images/flags/la.png +0 -0
  132. data/{vendor → app}/assets/images/flags/lb.png +0 -0
  133. data/{vendor → app}/assets/images/flags/lc.png +0 -0
  134. data/{vendor → app}/assets/images/flags/li.png +0 -0
  135. data/{vendor → app}/assets/images/flags/lk.png +0 -0
  136. data/{vendor → app}/assets/images/flags/lr.png +0 -0
  137. data/{vendor → app}/assets/images/flags/ls.png +0 -0
  138. data/{vendor → app}/assets/images/flags/lt.png +0 -0
  139. data/{vendor → app}/assets/images/flags/lu.png +0 -0
  140. data/{vendor → app}/assets/images/flags/lv.png +0 -0
  141. data/{vendor → app}/assets/images/flags/ly.png +0 -0
  142. data/{vendor → app}/assets/images/flags/ma.png +0 -0
  143. data/{vendor → app}/assets/images/flags/mc.png +0 -0
  144. data/{vendor → app}/assets/images/flags/md.png +0 -0
  145. data/{vendor → app}/assets/images/flags/me.png +0 -0
  146. data/{vendor → app}/assets/images/flags/mg.png +0 -0
  147. data/{vendor → app}/assets/images/flags/mh.png +0 -0
  148. data/{vendor → app}/assets/images/flags/mk.png +0 -0
  149. data/{vendor → app}/assets/images/flags/ml.png +0 -0
  150. data/{vendor → app}/assets/images/flags/mm.png +0 -0
  151. data/{vendor → app}/assets/images/flags/mn.png +0 -0
  152. data/{vendor → app}/assets/images/flags/mo.png +0 -0
  153. data/{vendor → app}/assets/images/flags/mp.png +0 -0
  154. data/{vendor → app}/assets/images/flags/mq.png +0 -0
  155. data/{vendor → app}/assets/images/flags/mr.png +0 -0
  156. data/{vendor → app}/assets/images/flags/ms.png +0 -0
  157. data/{vendor → app}/assets/images/flags/mt.png +0 -0
  158. data/{vendor → app}/assets/images/flags/mu.png +0 -0
  159. data/{vendor → app}/assets/images/flags/mv.png +0 -0
  160. data/{vendor → app}/assets/images/flags/mw.png +0 -0
  161. data/{vendor → app}/assets/images/flags/mx.png +0 -0
  162. data/{vendor → app}/assets/images/flags/my.png +0 -0
  163. data/{vendor → app}/assets/images/flags/mz.png +0 -0
  164. data/{vendor → app}/assets/images/flags/na.png +0 -0
  165. data/{vendor → app}/assets/images/flags/nc.png +0 -0
  166. data/{vendor → app}/assets/images/flags/ne.png +0 -0
  167. data/{vendor → app}/assets/images/flags/nf.png +0 -0
  168. data/{vendor → app}/assets/images/flags/ng.png +0 -0
  169. data/{vendor → app}/assets/images/flags/ni.png +0 -0
  170. data/{vendor → app}/assets/images/flags/nl.png +0 -0
  171. data/{vendor → app}/assets/images/flags/no.png +0 -0
  172. data/{vendor → app}/assets/images/flags/np.png +0 -0
  173. data/{vendor → app}/assets/images/flags/nr.png +0 -0
  174. data/{vendor → app}/assets/images/flags/nu.png +0 -0
  175. data/{vendor → app}/assets/images/flags/nz.png +0 -0
  176. data/{vendor → app}/assets/images/flags/om.png +0 -0
  177. data/{vendor → app}/assets/images/flags/pa.png +0 -0
  178. data/{vendor → app}/assets/images/flags/pe.png +0 -0
  179. data/{vendor → app}/assets/images/flags/pf.png +0 -0
  180. data/{vendor → app}/assets/images/flags/pg.png +0 -0
  181. data/{vendor → app}/assets/images/flags/ph.png +0 -0
  182. data/{vendor → app}/assets/images/flags/pk.png +0 -0
  183. data/{vendor → app}/assets/images/flags/pl.png +0 -0
  184. data/{vendor → app}/assets/images/flags/pm.png +0 -0
  185. data/{vendor → app}/assets/images/flags/pn.png +0 -0
  186. data/{vendor → app}/assets/images/flags/pr.png +0 -0
  187. data/{vendor → app}/assets/images/flags/ps.png +0 -0
  188. data/{vendor → app}/assets/images/flags/pt.png +0 -0
  189. data/{vendor → app}/assets/images/flags/pw.png +0 -0
  190. data/{vendor → app}/assets/images/flags/py.png +0 -0
  191. data/{vendor → app}/assets/images/flags/qa.png +0 -0
  192. data/{vendor → app}/assets/images/flags/re.png +0 -0
  193. data/{vendor → app}/assets/images/flags/ro.png +0 -0
  194. data/{vendor → app}/assets/images/flags/rs.png +0 -0
  195. data/{vendor → app}/assets/images/flags/ru.png +0 -0
  196. data/{vendor → app}/assets/images/flags/rw.png +0 -0
  197. data/{vendor → app}/assets/images/flags/sa.png +0 -0
  198. data/{vendor → app}/assets/images/flags/sb.png +0 -0
  199. data/{vendor → app}/assets/images/flags/sc.png +0 -0
  200. data/{vendor → app}/assets/images/flags/scotland.png +0 -0
  201. data/{vendor → app}/assets/images/flags/sd.png +0 -0
  202. data/{vendor → app}/assets/images/flags/se.png +0 -0
  203. data/{vendor → app}/assets/images/flags/sg.png +0 -0
  204. data/{vendor → app}/assets/images/flags/sh.png +0 -0
  205. data/{vendor → app}/assets/images/flags/si.png +0 -0
  206. data/{vendor → app}/assets/images/flags/sj.png +0 -0
  207. data/{vendor → app}/assets/images/flags/sk.png +0 -0
  208. data/{vendor → app}/assets/images/flags/sl.png +0 -0
  209. data/{vendor → app}/assets/images/flags/sm.png +0 -0
  210. data/{vendor → app}/assets/images/flags/sn.png +0 -0
  211. data/{vendor → app}/assets/images/flags/so.png +0 -0
  212. data/{vendor → app}/assets/images/flags/sr.png +0 -0
  213. data/{vendor → app}/assets/images/flags/st.png +0 -0
  214. data/{vendor → app}/assets/images/flags/sv.png +0 -0
  215. data/{vendor → app}/assets/images/flags/sy.png +0 -0
  216. data/{vendor → app}/assets/images/flags/sz.png +0 -0
  217. data/{vendor → app}/assets/images/flags/tc.png +0 -0
  218. data/{vendor → app}/assets/images/flags/td.png +0 -0
  219. data/{vendor → app}/assets/images/flags/tf.png +0 -0
  220. data/{vendor → app}/assets/images/flags/tg.png +0 -0
  221. data/{vendor → app}/assets/images/flags/th.png +0 -0
  222. data/{vendor → app}/assets/images/flags/tj.png +0 -0
  223. data/{vendor → app}/assets/images/flags/tk.png +0 -0
  224. data/{vendor → app}/assets/images/flags/tl.png +0 -0
  225. data/{vendor → app}/assets/images/flags/tm.png +0 -0
  226. data/{vendor → app}/assets/images/flags/tn.png +0 -0
  227. data/{vendor → app}/assets/images/flags/to.png +0 -0
  228. data/{vendor → app}/assets/images/flags/tr.png +0 -0
  229. data/{vendor → app}/assets/images/flags/tt.png +0 -0
  230. data/{vendor → app}/assets/images/flags/tv.png +0 -0
  231. data/{vendor → app}/assets/images/flags/tw.png +0 -0
  232. data/{vendor → app}/assets/images/flags/tz.png +0 -0
  233. data/{vendor → app}/assets/images/flags/ua.png +0 -0
  234. data/{vendor → app}/assets/images/flags/ug.png +0 -0
  235. data/{vendor → app}/assets/images/flags/um.png +0 -0
  236. data/{vendor → app}/assets/images/flags/us.png +0 -0
  237. data/{vendor → app}/assets/images/flags/uy.png +0 -0
  238. data/{vendor → app}/assets/images/flags/uz.png +0 -0
  239. data/{vendor → app}/assets/images/flags/va.png +0 -0
  240. data/{vendor → app}/assets/images/flags/vc.png +0 -0
  241. data/{vendor → app}/assets/images/flags/ve.png +0 -0
  242. data/{vendor → app}/assets/images/flags/vg.png +0 -0
  243. data/{vendor → app}/assets/images/flags/vi.png +0 -0
  244. data/{vendor → app}/assets/images/flags/vn.png +0 -0
  245. data/{vendor → app}/assets/images/flags/vu.png +0 -0
  246. data/{vendor → app}/assets/images/flags/wales.png +0 -0
  247. data/{vendor → app}/assets/images/flags/wf.png +0 -0
  248. data/{vendor → app}/assets/images/flags/ws.png +0 -0
  249. data/{vendor → app}/assets/images/flags/ye.png +0 -0
  250. data/{vendor → app}/assets/images/flags/yt.png +0 -0
  251. data/{vendor → app}/assets/images/flags/za.png +0 -0
  252. data/{vendor → app}/assets/images/flags/zm.png +0 -0
  253. data/{vendor → app}/assets/images/flags/zw.png +0 -0
  254. data/app/assets/images/logo/spree_50.png +0 -0
  255. data/app/assets/images/spree_header.jpg +0 -0
  256. data/app/assets/javascripts/spree/frontend.js +1 -1
  257. data/app/assets/javascripts/spree/frontend/checkout/payment.js.coffee +2 -2
  258. data/app/assets/stylesheets/spree/frontend.css +4 -4
  259. data/app/assets/stylesheets/spree/frontend/_variables.scss +4 -61
  260. data/app/assets/stylesheets/spree/frontend/frontend_bootstrap.css.scss +102 -0
  261. data/app/controllers/spree/checkout_controller.rb +31 -27
  262. data/app/controllers/spree/orders_controller.rb +20 -8
  263. data/app/controllers/spree/store_controller.rb +2 -3
  264. data/app/controllers/spree/taxons_controller.rb +2 -2
  265. data/app/helpers/spree/frontend_helper.rb +93 -0
  266. data/app/helpers/spree/orders_helper.rb +16 -0
  267. data/app/helpers/spree/store_helper.rb +10 -0
  268. data/app/helpers/spree/taxons_helper.rb +19 -0
  269. data/app/models/spree/frontend_configuration.rb +1 -1
  270. data/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb +13 -0
  271. data/app/views/kaminari/twitter-bootstrap-3/_gap.html.erb +8 -0
  272. data/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb +13 -0
  273. data/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb +13 -0
  274. data/app/views/kaminari/twitter-bootstrap-3/_page.html.erb +12 -0
  275. data/app/views/kaminari/twitter-bootstrap-3/_paginator.html.erb +24 -0
  276. data/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb +13 -0
  277. data/app/views/spree/address/_form.html.erb +24 -24
  278. data/app/views/spree/checkout/_address.html.erb +33 -22
  279. data/app/views/spree/checkout/_confirm.html.erb +10 -9
  280. data/app/views/spree/checkout/_delivery.html.erb +24 -20
  281. data/app/views/spree/checkout/_payment.html.erb +17 -18
  282. data/app/views/spree/checkout/_summary.html.erb +2 -2
  283. data/app/views/spree/checkout/edit.html.erb +23 -14
  284. data/app/views/spree/checkout/payment/_gateway.html.erb +31 -28
  285. data/app/views/spree/layouts/spree_application.html.erb +6 -12
  286. data/app/views/spree/orders/_adjustments.html.erb +5 -0
  287. data/app/views/spree/orders/_form.html.erb +8 -8
  288. data/app/views/spree/orders/_line_item.html.erb +6 -6
  289. data/app/views/spree/orders/edit.html.erb +14 -16
  290. data/app/views/spree/orders/show.html.erb +9 -4
  291. data/app/views/spree/products/_cart_form.html.erb +15 -11
  292. data/app/views/spree/products/_promotions.html.erb +1 -1
  293. data/app/views/spree/products/_properties.html.erb +2 -2
  294. data/app/views/spree/products/_taxons.html.erb +4 -4
  295. data/app/views/spree/products/_thumbnails.html.erb +3 -3
  296. data/app/views/spree/products/index.html.erb +13 -9
  297. data/app/views/spree/products/show.html.erb +11 -9
  298. data/app/views/spree/shared/_error_messages.html.erb +12 -0
  299. data/app/views/spree/shared/_filters.html.erb +4 -4
  300. data/app/views/spree/shared/_footer.html.erb +10 -6
  301. data/app/views/spree/shared/_google_add_items.js.erb +11 -0
  302. data/app/views/spree/shared/_google_analytics.js.erb +13 -0
  303. data/app/views/spree/shared/_google_checkout.js.erb +10 -0
  304. data/app/views/spree/shared/_google_purchase.js.erb +13 -0
  305. data/app/views/spree/shared/_head.html.erb +1 -1
  306. data/app/views/spree/shared/_header.html.erb +17 -5
  307. data/app/views/spree/shared/_login.html.erb +19 -0
  308. data/app/views/spree/shared/_login_bar.html.erb +6 -0
  309. data/app/views/spree/shared/_main_nav_bar.html.erb +15 -11
  310. data/app/views/spree/shared/_nav_bar.html.erb +3 -2
  311. data/app/views/spree/shared/_order_details.html.erb +30 -31
  312. data/app/views/spree/shared/_products.html.erb +19 -15
  313. data/app/views/spree/shared/_search.html.erb +8 -4
  314. data/app/views/spree/shared/_sidebar.html.erb +1 -1
  315. data/app/views/spree/shared/_taxonomies.html.erb +1 -1
  316. data/app/views/spree/taxons/show.html.erb +1 -1
  317. data/config/initializers/spree.rb +0 -2
  318. data/lib/spree/frontend.rb +5 -4
  319. data/lib/spree/frontend/engine.rb +2 -2
  320. data/script/rails +9 -0
  321. data/spec/controllers/controller_extension_spec.rb +115 -0
  322. data/spec/controllers/controller_helpers_spec.rb +26 -0
  323. data/spec/controllers/spree/checkout_controller_spec.rb +424 -0
  324. data/spec/controllers/spree/checkout_controller_with_views_spec.rb +36 -0
  325. data/spec/controllers/spree/content_controller_spec.rb +12 -0
  326. data/spec/controllers/spree/current_order_tracking_spec.rb +44 -0
  327. data/spec/controllers/spree/home_controller_spec.rb +27 -0
  328. data/spec/controllers/spree/orders_controller_ability_spec.rb +104 -0
  329. data/spec/controllers/spree/orders_controller_spec.rb +134 -0
  330. data/spec/controllers/spree/orders_controller_transitions_spec.rb +31 -0
  331. data/spec/controllers/spree/products_controller_spec.rb +36 -0
  332. data/spec/controllers/spree/taxons_controller_spec.rb +12 -0
  333. data/spec/features/address_spec.rb +93 -0
  334. data/spec/features/automatic_promotion_adjustments_spec.rb +47 -0
  335. data/spec/features/caching/products_spec.rb +55 -0
  336. data/spec/features/caching/taxons_spec.rb +22 -0
  337. data/spec/features/cart_spec.rb +84 -0
  338. data/spec/features/checkout_spec.rb +515 -0
  339. data/spec/features/checkout_unshippable_spec.rb +34 -0
  340. data/spec/features/coupon_code_spec.rb +87 -0
  341. data/spec/features/currency_spec.rb +18 -0
  342. data/spec/features/free_shipping_promotions_spec.rb +59 -0
  343. data/spec/features/locale_spec.rb +60 -0
  344. data/spec/features/order_spec.rb +74 -0
  345. data/spec/features/page_promotions_spec.rb +36 -0
  346. data/spec/features/products_spec.rb +262 -0
  347. data/spec/features/taxons_spec.rb +147 -0
  348. data/spec/features/template_rendering_spec.rb +19 -0
  349. data/spec/fixtures/thinking-cat.jpg +0 -0
  350. data/spec/helpers/frontend_helper_spec.rb +41 -0
  351. data/spec/helpers/order_helper_spec.rb +12 -0
  352. data/spec/helpers/taxons_helper_spec.rb +17 -0
  353. data/spec/spec_helper.rb +115 -0
  354. data/spec/support/shared_contexts/checkout_setup.rb +9 -0
  355. data/spec/support/shared_contexts/custom_products.rb +25 -0
  356. data/spec/support/shared_contexts/product_prototypes.rb +30 -0
  357. data/spec/views/spree/checkout/_summary_spec.rb +11 -0
  358. data/spree_frontend.gemspec +30 -0
  359. metadata +392 -282
  360. data/app/assets/images/icons/add-to-cart.png +0 -0
  361. data/app/assets/images/icons/checkout.png +0 -0
  362. data/app/assets/images/icons/delete.png +0 -0
  363. data/app/assets/images/icons/update.png +0 -0
  364. data/app/assets/images/spinner.gif +0 -0
  365. data/app/assets/images/spree/frontend/cart.png +0 -0
  366. data/app/assets/images/spree/frontend/select_arrow.gif +0 -0
  367. data/app/assets/stylesheets/spree/frontend/screen.css.scss +0 -1321
  368. data/app/views/spree/shared/_google_analytics.html.erb +0 -40
  369. data/config/initializers/assets.rb +0 -1
  370. data/config/initializers/check_for_orphaned_preferences.rb +0 -9
  371. data/config/initializers/deprecation_checker.rb +0 -7
  372. data/config/initializers/rails_5868.rb +0 -8
  373. data/lib/spree/frontend/preference_rescue.rb +0 -25
  374. data/vendor/assets/images/datepicker/cal.gif +0 -0
  375. data/vendor/assets/images/jquery.formalize/button.png +0 -0
  376. data/vendor/assets/images/jquery.formalize/select_arrow.gif +0 -0
  377. data/vendor/assets/javascripts/jquery.formalize.min.js +0 -1
  378. data/vendor/assets/stylesheets/jquery.formalize.css.erb +0 -363
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe "checkout with unshippable items", type: :feature, inaccessible: true do
4
+ let!(:stock_location) { create(:stock_location) }
5
+ let(:order) { OrderWalkthrough.up_to(:address) }
6
+
7
+ before do
8
+ OrderWalkthrough.add_line_item!(order)
9
+ line_item = order.line_items.last
10
+ stock_item = stock_location.stock_item(line_item.variant)
11
+ stock_item.adjust_count_on_hand -999
12
+ stock_item.backorderable = false
13
+ stock_item.save!
14
+
15
+ user = create(:user)
16
+ order.user = user
17
+ order.update!
18
+
19
+ allow_any_instance_of(Spree::CheckoutController).to receive_messages(:current_order => order)
20
+ allow_any_instance_of(Spree::CheckoutController).to receive_messages(:try_spree_current_user => user)
21
+ allow_any_instance_of(Spree::CheckoutController).to receive_messages(:skip_state_validation? => true)
22
+ allow_any_instance_of(Spree::CheckoutController).to receive_messages(:ensure_sufficient_stock_lines => true)
23
+ end
24
+
25
+ it 'displays and removes' do
26
+ visit spree.checkout_state_path(:delivery)
27
+ expect(page).to have_content('Unshippable Items')
28
+
29
+ click_button "Save and Continue"
30
+
31
+ order.reload
32
+ expect(order.line_items.count).to eq 1
33
+ end
34
+ end
@@ -0,0 +1,87 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Coupon code promotions", type: :feature, js: true do
4
+ let!(:country) { create(:country, name: "United States of America", states_required: true) }
5
+ let!(:state) { create(:state, name: "Alabama", country: country) }
6
+ let!(:zone) { create(:zone) }
7
+ let!(:shipping_method) { create(:shipping_method) }
8
+ let!(:payment_method) { create(:check_payment_method) }
9
+ let!(:product) { create(:product, name: "RoR Mug", price: 20) }
10
+
11
+ context "visitor makes checkout as guest without registration" do
12
+ def create_basic_coupon_promotion(code)
13
+ promotion = Spree::Promotion.create!(name: code.titleize,
14
+ code: code,
15
+ starts_at: 1.day.ago,
16
+ expires_at: 1.day.from_now)
17
+
18
+ calculator = Spree::Calculator::FlatRate.new
19
+ calculator.preferred_amount = 10
20
+
21
+ action = Spree::Promotion::Actions::CreateItemAdjustments.new
22
+ action.calculator = calculator
23
+ action.promotion = promotion
24
+ action.save
25
+
26
+ promotion.reload # so that promotion.actions is available
27
+ end
28
+
29
+ let!(:promotion) { create_basic_coupon_promotion("onetwo") }
30
+
31
+ # OrdersController
32
+ context "on the payment page" do
33
+ before do
34
+ visit spree.root_path
35
+ click_link "RoR Mug"
36
+ click_button "add-to-cart-button"
37
+ click_button "Checkout"
38
+ fill_in "order_email", with: "spree@example.com"
39
+ fill_in "First Name", with: "John"
40
+ fill_in "Last Name", with: "Smith"
41
+ fill_in "Street Address", with: "1 John Street"
42
+ fill_in "City", with: "City of John"
43
+ fill_in "Zip", with: "01337"
44
+ select country.name, from: "Country"
45
+ select state.name, from: "order[bill_address_attributes][state_id]"
46
+ fill_in "Phone", with: "555-555-5555"
47
+
48
+ # To shipping method screen
49
+ click_button "Save and Continue"
50
+ # To payment screen
51
+ click_button "Save and Continue"
52
+ end
53
+
54
+ it "informs about an invalid coupon code" do
55
+ fill_in "order_coupon_code", with: "coupon_codes_rule_man"
56
+ click_button "Save and Continue"
57
+ expect(page).to have_content(Spree.t(:coupon_code_not_found))
58
+ end
59
+
60
+ it "informs the user about a coupon code which has exceeded its usage" do
61
+ promotion.update_column(:usage_limit, 5)
62
+ allow_any_instance_of(promotion.class).to receive_messages(credits_count: 10)
63
+
64
+ fill_in "order_coupon_code", with: "onetwo"
65
+ click_button "Save and Continue"
66
+ expect(page).to have_content(Spree.t(:coupon_code_max_usage))
67
+ end
68
+
69
+ it "can enter an invalid coupon code, then a real one" do
70
+ fill_in "order_coupon_code", with: "coupon_codes_rule_man"
71
+ click_button "Save and Continue"
72
+ expect(page).to have_content(Spree.t(:coupon_code_not_found))
73
+ fill_in "order_coupon_code", with: "onetwo"
74
+ click_button "Save and Continue"
75
+ expect(page).to have_content("Promotion (Onetwo) -$10.00")
76
+ end
77
+
78
+ context "with a promotion" do
79
+ it "applies a promotion to an order" do
80
+ fill_in "order_coupon_code", with: "onetwo"
81
+ click_button "Save and Continue"
82
+ expect(page).to have_content("Promotion (Onetwo) -$10.00")
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Switching currencies in backend", :type => :feature do
4
+ before do
5
+ create(:base_product, :name => "RoR Mug")
6
+ end
7
+
8
+ # Regression test for #2340
9
+ it "does not cause current_order to become nil", inaccessible: true do
10
+ visit spree.root_path
11
+ click_link "RoR Mug"
12
+ click_button "Add To Cart"
13
+ # Now that we have an order...
14
+ Spree::Config[:currency] = "AUD"
15
+ expect { visit spree.root_path }.not_to raise_error
16
+ end
17
+
18
+ end
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Free shipping promotions", :type => :feature, :js => true do
4
+ let!(:country) { create(:country, :name => "United States of America", :states_required => true) }
5
+ let!(:state) { create(:state, :name => "Alabama", :country => country) }
6
+ let!(:zone) { create(:zone) }
7
+ let!(:shipping_method) do
8
+ sm = create(:shipping_method)
9
+ sm.calculator.preferred_amount = 10
10
+ sm.calculator.save
11
+ sm
12
+ end
13
+
14
+ let!(:payment_method) { create(:check_payment_method) }
15
+ let!(:product) { create(:product, :name => "RoR Mug", :price => 20) }
16
+ let!(:promotion) do
17
+ promotion = Spree::Promotion.create!(:name => "Free Shipping",
18
+ :starts_at => 1.day.ago,
19
+ :expires_at => 1.day.from_now)
20
+
21
+ action = Spree::Promotion::Actions::FreeShipping.new
22
+ action.promotion = promotion
23
+ action.save
24
+
25
+ promotion.reload # so that promotion.actions is available
26
+ end
27
+
28
+ context "free shipping promotion automatically applied" do
29
+ before do
30
+
31
+ visit spree.root_path
32
+ click_link "RoR Mug"
33
+ click_button "add-to-cart-button"
34
+ click_button "Checkout"
35
+ fill_in "order_email", :with => "spree@example.com"
36
+ fill_in "First Name", :with => "John"
37
+ fill_in "Last Name", :with => "Smith"
38
+ fill_in "Street Address", :with => "1 John Street"
39
+ fill_in "City", :with => "City of John"
40
+ fill_in "Zip", :with => "01337"
41
+ select country.name, :from => "Country"
42
+ select state.name, :from => "order[bill_address_attributes][state_id]"
43
+ fill_in "Phone", :with => "555-555-5555"
44
+
45
+ # To shipping method screen
46
+ click_button "Save and Continue"
47
+ # To payment screen
48
+ click_button "Save and Continue"
49
+ end
50
+
51
+ # Regression test for #4428
52
+ it "applies the free shipping promotion" do
53
+ within("#checkout-summary") do
54
+ expect(page).to have_content("Shipping total: $10.00")
55
+ expect(page).to have_content("Promotion (Free Shipping): -$10.00")
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'setting locale', type: :feature do
4
+ def with_locale(locale)
5
+ I18n.locale = locale
6
+ Spree::Frontend::Config[:locale] = locale
7
+ yield
8
+ I18n.locale = 'en'
9
+ Spree::Frontend::Config[:locale] = 'en'
10
+ end
11
+
12
+ context 'shopping cart link and page' do
13
+ before do
14
+ I18n.backend.store_translations(:fr,
15
+ spree: {
16
+ cart: 'Panier',
17
+ shopping_cart: 'Panier'
18
+ })
19
+ end
20
+
21
+ it 'should be in french' do
22
+ with_locale('fr') do
23
+ visit spree.root_path
24
+ click_link 'Panier'
25
+ expect(page).to have_content('Panier')
26
+ end
27
+ end
28
+ end
29
+
30
+ context 'checkout form validation messages' do
31
+ include_context 'checkout setup'
32
+
33
+ let(:error_messages) do
34
+ {
35
+ 'en' => 'This field is required.',
36
+ 'fr' => 'Ce champ est obligatoire.',
37
+ 'de' => 'Dieses Feld ist ein Pflichtfeld.',
38
+ }
39
+ end
40
+
41
+ def check_error_text(text)
42
+ %w(firstname lastname address1 city).each do |attr|
43
+ expect(find("#b#{attr} label.error").text).to eq(text)
44
+ end
45
+ end
46
+
47
+ it 'shows translated jquery.validate error messages', js: true do
48
+ visit spree.root_path
49
+ click_link mug.name
50
+ click_button 'add-to-cart-button'
51
+ error_messages.each do |locale, message|
52
+ with_locale(locale) do
53
+ visit '/checkout/address'
54
+ find('.form-buttons input[type=submit]').click
55
+ check_error_text message
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,74 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'orders', :type => :feature do
4
+ let(:order) { OrderWalkthrough.up_to(:complete) }
5
+ let(:user) { create(:user) }
6
+
7
+ before do
8
+ order.update_attribute(:user_id, user.id)
9
+ order.shipments.destroy_all
10
+ allow_any_instance_of(Spree::OrdersController).to receive_messages(:try_spree_current_user => user)
11
+ end
12
+
13
+ it "can visit an order" do
14
+ # Regression test for current_user call on orders/show
15
+ expect { visit spree.order_path(order) }.not_to raise_error
16
+ end
17
+
18
+ it "should display line item price" do
19
+ # Regression test for #2772
20
+ line_item = order.line_items.first
21
+ line_item.target_shipment = create(:shipment)
22
+ line_item.price = 19.00
23
+ line_item.save!
24
+
25
+ visit spree.order_path(order)
26
+
27
+ # Tests view spree/shared/_order_details
28
+ within 'td.price' do
29
+ expect(page).to have_content "19.00"
30
+ end
31
+ end
32
+
33
+ it "should have credit card info if paid with credit card" do
34
+ create(:payment, :order => order)
35
+ visit spree.order_path(order)
36
+ within '.payment-info' do
37
+ expect(page).to have_content "Ending in 1111"
38
+ end
39
+ end
40
+
41
+ it "should have payment method name visible if not paid with credit card" do
42
+ create(:check_payment, :order => order)
43
+ visit spree.order_path(order)
44
+ within '.payment-info' do
45
+ expect(page).to have_content "Check"
46
+ end
47
+ end
48
+
49
+ # Regression test for #2282
50
+ context "can support a credit card with blank information" do
51
+ before do
52
+ credit_card = create(:credit_card)
53
+ credit_card.update_column(:cc_type, '')
54
+ payment = order.payments.first
55
+ payment.source = credit_card
56
+ payment.save!
57
+ end
58
+
59
+ specify do
60
+ visit spree.order_path(order)
61
+ within '.payment-info' do
62
+ expect { find("img") }.to raise_error(Capybara::ElementNotFound)
63
+ end
64
+ end
65
+ end
66
+
67
+ it "should return the correct title when displaying a completed order" do
68
+ visit spree.order_path(order)
69
+
70
+ within '#order_summary' do
71
+ expect(page).to have_content("#{Spree.t(:order)} #{order.number}")
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'page promotions', :type => :feature do
4
+ let!(:product) { create(:product, :name => "RoR Mug", :price => 20) }
5
+ before do
6
+ promotion = Spree::Promotion.create!(:name => "$10 off",
7
+ :path => 'test',
8
+ :starts_at => 1.day.ago,
9
+ :expires_at => 1.day.from_now)
10
+
11
+ calculator = Spree::Calculator::FlatRate.new
12
+ calculator.preferred_amount = 10
13
+
14
+ action = Spree::Promotion::Actions::CreateItemAdjustments.create(:calculator => calculator)
15
+ promotion.actions << action
16
+
17
+ visit spree.root_path
18
+ click_link "RoR Mug"
19
+ click_button "add-to-cart-button"
20
+ end
21
+
22
+ it "automatically applies a page promotion upon visiting" do
23
+ expect(page).not_to have_content("Promotion ($10 off) -$10.00")
24
+ visit '/content/test'
25
+ visit '/cart'
26
+ expect(page).to have_content("Promotion ($10 off) -$10.00")
27
+ expect(page).to have_content("Subtotal (1 item) $20.00")
28
+ end
29
+
30
+ it "does not activate an adjustment for a path that doesn't have a promotion" do
31
+ expect(page).not_to have_content("Promotion ($10 off) -$10.00")
32
+ visit '/content/cvv'
33
+ visit '/cart'
34
+ expect(page).not_to have_content("Promotion ($10 off) -$10.00")
35
+ end
36
+ end
@@ -0,0 +1,262 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe "Visiting Products", type: :feature, inaccessible: true do
5
+ include_context "custom products"
6
+
7
+ let(:store_name) do
8
+ ((first_store = Spree::Store.first) && first_store.name).to_s
9
+ end
10
+
11
+ before(:each) do
12
+ visit spree.root_path
13
+ end
14
+
15
+ it "should be able to show the shopping cart after adding a product to it" do
16
+ click_link "Ruby on Rails Ringer T-Shirt"
17
+ expect(page).to have_content("$19.99")
18
+
19
+ click_button 'add-to-cart-button'
20
+ expect(page).to have_content("Shopping Cart")
21
+ end
22
+
23
+ describe 'meta tags and title' do
24
+ let(:jersey) { Spree::Product.find_by_name('Ruby on Rails Baseball Jersey') }
25
+ let(:metas) { { meta_description: 'Brand new Ruby on Rails Jersey', meta_title: 'Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel', meta_keywords: 'ror, jersey, ruby' } }
26
+
27
+ it 'should return the correct title when displaying a single product' do
28
+ click_link jersey.name
29
+ expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
30
+ within('div#product-description') do
31
+ within('h1.product-title') do
32
+ expect(page).to have_content('Ruby on Rails Baseball Jersey')
33
+ end
34
+ end
35
+ end
36
+
37
+ it 'displays metas' do
38
+ jersey.update_attributes metas
39
+ click_link jersey.name
40
+ expect(page).to have_meta(:description, 'Brand new Ruby on Rails Jersey')
41
+ expect(page).to have_meta(:keywords, 'ror, jersey, ruby')
42
+ end
43
+
44
+ it 'displays title if set' do
45
+ jersey.update_attributes metas
46
+ click_link jersey.name
47
+ expect(page).to have_title('Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel')
48
+ end
49
+
50
+ it "doesn't use meta_title as heading on page" do
51
+ jersey.update_attributes metas
52
+ click_link jersey.name
53
+ within("h1") do
54
+ expect(page).to have_content(jersey.name)
55
+ expect(page).not_to have_content(jersey.meta_title)
56
+ end
57
+ end
58
+
59
+ it 'uses product name in title when meta_title set to empty string' do
60
+ jersey.update_attributes meta_title: ''
61
+ click_link jersey.name
62
+ expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
63
+ end
64
+ end
65
+
66
+ context "using Russian Rubles as a currency" do
67
+ before do
68
+ Spree::Config[:currency] = "RUB"
69
+ end
70
+
71
+ let!(:product) do
72
+ product = Spree::Product.find_by_name("Ruby on Rails Ringer T-Shirt")
73
+ product.price = 19.99
74
+ product.tap(&:save)
75
+ end
76
+
77
+ # Regression tests for #2737
78
+ context "uses руб as the currency symbol" do
79
+ it "on products page" do
80
+ visit spree.root_path
81
+ within("#product_#{product.id}") do
82
+ within(".price") do
83
+ expect(page).to have_content("19.99 ₽")
84
+ end
85
+ end
86
+ end
87
+
88
+ it "on product page" do
89
+ visit spree.product_path(product)
90
+ within(".price") do
91
+ expect(page).to have_content("19.99 ₽")
92
+ end
93
+ end
94
+
95
+ it "when adding a product to the cart", js: true do
96
+ visit spree.product_path(product)
97
+ click_button "Add To Cart"
98
+ click_link "Home"
99
+ within(".cart-info") do
100
+ expect(page).to have_content("19.99 ₽")
101
+ end
102
+ end
103
+
104
+ it "when on the 'address' state of the cart", js: true do
105
+ visit spree.product_path(product)
106
+ click_button "Add To Cart"
107
+ click_button "Checkout"
108
+ fill_in "order_email", with: "test@example.com"
109
+ click_button 'Continue'
110
+ within("tr[data-hook=item_total]") do
111
+ expect(page).to have_content("19.99 ₽")
112
+ end
113
+ end
114
+ end
115
+ end
116
+
117
+ it "should be able to search for a product" do
118
+ fill_in "keywords", with: "shirt"
119
+ click_button "Search"
120
+
121
+ expect(page.all('#products .product-list-item').size).to eq(1)
122
+ end
123
+
124
+ context "a product with variants" do
125
+ let(:product) { Spree::Product.find_by_name("Ruby on Rails Baseball Jersey") }
126
+ let(:option_value) { create(:option_value) }
127
+ let!(:variant) { product.variants.create!(:price => 5.59) }
128
+
129
+ before do
130
+ # Need to have two images to trigger the error
131
+ image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
132
+ product.images.create!(:attachment => image)
133
+ product.images.create!(:attachment => image)
134
+
135
+ product.option_types << option_value.option_type
136
+ variant.option_values << option_value
137
+ end
138
+
139
+ it "should be displayed" do
140
+ expect { click_link product.name }.to_not raise_error
141
+ end
142
+
143
+ it "displays price of first variant listed", js: true do
144
+ click_link product.name
145
+ within("#product-price") do
146
+ expect(page).to have_content variant.price
147
+ expect(page).not_to have_content Spree.t(:out_of_stock)
148
+ end
149
+ end
150
+
151
+ it "doesn't display out of stock for master product" do
152
+ product.master.stock_items.update_all count_on_hand: 0, backorderable: false
153
+
154
+ click_link product.name
155
+ within("#product-price") do
156
+ expect(page).not_to have_content Spree.t(:out_of_stock)
157
+ end
158
+ end
159
+ end
160
+
161
+ context "a product with variants, images only for the variants" do
162
+ let(:product) { Spree::Product.find_by_name("Ruby on Rails Baseball Jersey") }
163
+
164
+ before do
165
+ image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
166
+ v1 = product.variants.create!(price: 9.99)
167
+ v2 = product.variants.create!(price: 10.99)
168
+ v1.images.create!(attachment: image)
169
+ v2.images.create!(attachment: image)
170
+ end
171
+
172
+ it "should not display no image available" do
173
+ visit spree.root_path
174
+ expect(page).to have_xpath("//img[contains(@src,'thinking-cat')]")
175
+ end
176
+ end
177
+
178
+ it "should be able to hide products without price" do
179
+ expect(page.all('#products .product-list-item').size).to eq(9)
180
+ Spree::Config.show_products_without_price = false
181
+ Spree::Config.currency = "CAN"
182
+ visit spree.root_path
183
+ expect(page.all('#products .product-list-item').size).to eq(0)
184
+ end
185
+
186
+
187
+ it "should be able to display products priced under 10 dollars" do
188
+ within(:css, '#taxonomies') { click_link "Ruby on Rails" }
189
+ check "Price_Range_Under_$10.00"
190
+ within(:css, '#sidebar_products_search') { click_button "Search" }
191
+ expect(page).to have_content("No products found")
192
+ end
193
+
194
+ it "should be able to display products priced between 15 and 18 dollars" do
195
+ within(:css, '#taxonomies') { click_link "Ruby on Rails" }
196
+ check "Price_Range_$15.00_-_$18.00"
197
+ within(:css, '#sidebar_products_search') { click_button "Search" }
198
+
199
+ expect(page.all('#products .product-list-item').size).to eq(3)
200
+ tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
201
+ tmp.delete("")
202
+ expect(tmp.sort!).to eq(["Ruby on Rails Mug", "Ruby on Rails Stein", "Ruby on Rails Tote"])
203
+ end
204
+
205
+ it "should be able to display products priced between 15 and 18 dollars across multiple pages" do
206
+ Spree::Config.products_per_page = 2
207
+ within(:css, '#taxonomies') { click_link "Ruby on Rails" }
208
+ check "Price_Range_$15.00_-_$18.00"
209
+ within(:css, '#sidebar_products_search') { click_button "Search" }
210
+
211
+ expect(page.all('#products .product-list-item').size).to eq(2)
212
+ products = page.all('#products .product-list-item a[itemprop=name]')
213
+ expect(products.count).to eq(2)
214
+
215
+ find('.pagination .next a').click
216
+ products = page.all('#products .product-list-item a[itemprop=name]')
217
+ expect(products.count).to eq(1)
218
+ end
219
+
220
+ it "should be able to display products priced 18 dollars and above" do
221
+ within(:css, '#taxonomies') { click_link "Ruby on Rails" }
222
+ check "Price_Range_$18.00_-_$20.00"
223
+ check "Price_Range_$20.00_or_over"
224
+ within(:css, '#sidebar_products_search') { click_button "Search" }
225
+
226
+ expect(page.all('#products .product-list-item').size).to eq(4)
227
+ tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
228
+ tmp.delete("")
229
+ expect(tmp.sort!).to eq(["Ruby on Rails Bag",
230
+ "Ruby on Rails Baseball Jersey",
231
+ "Ruby on Rails Jr. Spaghetti",
232
+ "Ruby on Rails Ringer T-Shirt"])
233
+ end
234
+
235
+ it "should be able to put a product without a description in the cart" do
236
+ product = FactoryGirl.create(:base_product, :description => nil, :name => 'Sample', :price => '19.99')
237
+ visit spree.product_path(product)
238
+ expect(page).to have_content "This product has no description"
239
+ click_button 'add-to-cart-button'
240
+ expect(page).to have_content "This product has no description"
241
+ end
242
+
243
+ it "shouldn't be able to put a product without a current price in the cart" do
244
+ product = FactoryGirl.create(:base_product, :description => nil, :name => 'Sample', :price => '19.99')
245
+ Spree::Config.currency = "CAN"
246
+ Spree::Config.show_products_without_price = true
247
+ visit spree.product_path(product)
248
+ expect(page).to have_content "This product is not available in the selected currency."
249
+ expect(page).not_to have_content "add-to-cart-button"
250
+ end
251
+
252
+ it "should return the correct title when displaying a single product" do
253
+ product = Spree::Product.find_by_name("Ruby on Rails Baseball Jersey")
254
+ click_link product.name
255
+
256
+ within("div#product-description") do
257
+ within("h1.product-title") do
258
+ expect(page).to have_content("Ruby on Rails Baseball Jersey")
259
+ end
260
+ end
261
+ end
262
+ end