office_clerk 0.0.1

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.
Files changed (259) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +73 -0
  3. data/.rubocop.yml +6 -0
  4. data/.travis.yml +9 -0
  5. data/Gemfile +63 -0
  6. data/Gemfile.lock +367 -0
  7. data/Guardfile +28 -0
  8. data/README.md +44 -0
  9. data/Rakefile +6 -0
  10. data/app/assets/images/admin/baskets-2.jpg +0 -0
  11. data/app/assets/images/admin/baskets.jpg +0 -0
  12. data/app/assets/images/admin/categories-2.jpg +0 -0
  13. data/app/assets/images/admin/categories.jpg +0 -0
  14. data/app/assets/images/admin/clerks-2.jpg +0 -0
  15. data/app/assets/images/admin/clerks.jpg +0 -0
  16. data/app/assets/images/admin/orders-2.jpg +0 -0
  17. data/app/assets/images/admin/orders.jpg +0 -0
  18. data/app/assets/images/admin/products-2.jpg +0 -0
  19. data/app/assets/images/admin/products.jpg +0 -0
  20. data/app/assets/images/admin/purchases-2.jpg +0 -0
  21. data/app/assets/images/admin/purchases.jpg +0 -0
  22. data/app/assets/images/admin/suppliers-2.jpg +0 -0
  23. data/app/assets/images/admin/suppliers.jpg +0 -0
  24. data/app/assets/images/alpha.png +0 -0
  25. data/app/assets/images/down-icon.png +0 -0
  26. data/app/assets/images/header.gif +0 -0
  27. data/app/assets/images/hihih.jpg +0 -0
  28. data/app/assets/images/hue.png +0 -0
  29. data/app/assets/images/koe.jpg +0 -0
  30. data/app/assets/images/missing.png +0 -0
  31. data/app/assets/images/saturation.png +0 -0
  32. data/app/assets/images/shop/basket.jpg +0 -0
  33. data/app/assets/images/shop/farfalla-logo.jpg +0 -0
  34. data/app/assets/images/shop/header.gif +0 -0
  35. data/app/assets/images/shop/header.jpg +0 -0
  36. data/app/assets/images/shop/header.png +0 -0
  37. data/app/assets/images/shop/kansi.jpg +0 -0
  38. data/app/assets/images/shop/kansi.png +0 -0
  39. data/app/assets/images/shop/logo.png +0 -0
  40. data/app/assets/images/shop/menu-gourmet.jpg +0 -0
  41. data/app/assets/images/shop/menu-hius.jpg +0 -0
  42. data/app/assets/images/shop/menu-huonetuoksu.jpg +0 -0
  43. data/app/assets/images/shop/menu-info.jpg +0 -0
  44. data/app/assets/images/shop/menu-kasvo.jpg +0 -0
  45. data/app/assets/images/shop/menu-laukut.jpg +0 -0
  46. data/app/assets/images/shop/menu-luomu.jpg +0 -0
  47. data/app/assets/images/shop/menu-men.jpg +0 -0
  48. data/app/assets/images/shop/menu-oljy.jpg +0 -0
  49. data/app/assets/images/shop/menu-tuoksu1.jpg +0 -0
  50. data/app/assets/images/shop/menu-vaatteet.jpg +0 -0
  51. data/app/assets/images/shop/menu-valaisin.jpg +0 -0
  52. data/app/assets/images/shop/menu-vartalo.jpg +0 -0
  53. data/app/assets/images/shop/spacer.gif +0 -0
  54. data/app/assets/images/shop/tausta.jpg +0 -0
  55. data/app/assets/images/shop/tervetuloa.gif +0 -0
  56. data/app/assets/images/shop/valk.png +0 -0
  57. data/app/assets/images/shop/valk3.png +0 -0
  58. data/app/assets/images/shop/violetti-lev.jpg +0 -0
  59. data/app/assets/images/shop/violetti.jpg +0 -0
  60. data/app/assets/images/ui-anim_basic_16x16.gif +0 -0
  61. data/app/assets/images/up-icon.png +0 -0
  62. data/app/assets/javascripts/admin.js +29 -0
  63. data/app/assets/javascripts/shop.js +30 -0
  64. data/app/assets/stylesheets/admin.css.scss +129 -0
  65. data/app/assets/stylesheets/shop-receipt.css.scss +80 -0
  66. data/app/assets/stylesheets/shop.css.scss +403 -0
  67. data/app/controllers/admin_controller.rb +23 -0
  68. data/app/controllers/application_controller.rb +41 -0
  69. data/app/controllers/baskets_controller.rb +176 -0
  70. data/app/controllers/categories_controller.rb +69 -0
  71. data/app/controllers/clerks_controller.rb +64 -0
  72. data/app/controllers/orders_controller.rb +57 -0
  73. data/app/controllers/products_controller.rb +126 -0
  74. data/app/controllers/purchases_controller.rb +72 -0
  75. data/app/controllers/sessions_controller.rb +46 -0
  76. data/app/controllers/shop_controller.rb +90 -0
  77. data/app/controllers/suppliers_controller.rb +63 -0
  78. data/app/helpers/admin_helper.rb +28 -0
  79. data/app/helpers/application_helper.rb +25 -0
  80. data/app/helpers/baskets_helper.rb +4 -0
  81. data/app/helpers/categories_helper.rb +4 -0
  82. data/app/helpers/orders_helper.rb +4 -0
  83. data/app/helpers/products_helper.rb +4 -0
  84. data/app/helpers/purchases_helper.rb +4 -0
  85. data/app/helpers/shop_helper.rb +17 -0
  86. data/app/helpers/suppliers_helper.rb +4 -0
  87. data/app/mailers/.keep +0 -0
  88. data/app/models/basket.rb +114 -0
  89. data/app/models/category.rb +27 -0
  90. data/app/models/clerk.rb +46 -0
  91. data/app/models/item.rb +26 -0
  92. data/app/models/order.rb +72 -0
  93. data/app/models/product.rb +100 -0
  94. data/app/models/purchase.rb +26 -0
  95. data/app/models/supplier.rb +15 -0
  96. data/app/views/addresses/_form_fields.html.haml +4 -0
  97. data/app/views/addresses/show.html.haml +23 -0
  98. data/app/views/baskets/_small.html.haml +25 -0
  99. data/app/views/baskets/edit.html.haml +74 -0
  100. data/app/views/baskets/index.html.haml +55 -0
  101. data/app/views/baskets/show.html.haml +18 -0
  102. data/app/views/categories/_treeview.html.haml +8 -0
  103. data/app/views/categories/_triple.html.haml +12 -0
  104. data/app/views/categories/edit.html.haml +36 -0
  105. data/app/views/categories/index.html.haml +49 -0
  106. data/app/views/categories/show.html.haml +30 -0
  107. data/app/views/clerks/edit.html.haml +20 -0
  108. data/app/views/clerks/index.html.haml +37 -0
  109. data/app/views/clerks/show.html.haml +19 -0
  110. data/app/views/layouts/_admin_menu.html.haml +14 -0
  111. data/app/views/layouts/_google.haml +8 -0
  112. data/app/views/layouts/_messages.html.haml +5 -0
  113. data/app/views/layouts/admin.html.haml +42 -0
  114. data/app/views/layouts/shop.html.haml +96 -0
  115. data/app/views/orders/edit.html.haml +25 -0
  116. data/app/views/orders/index.html.haml +93 -0
  117. data/app/views/orders/show.html.haml +37 -0
  118. data/app/views/products/_line.html.haml +25 -0
  119. data/app/views/products/_name.html.haml +4 -0
  120. data/app/views/products/_online.html.haml +2 -0
  121. data/app/views/products/_triple.html.haml +12 -0
  122. data/app/views/products/edit.html.haml +42 -0
  123. data/app/views/products/index.html.haml +86 -0
  124. data/app/views/products/show.html.haml +94 -0
  125. data/app/views/purchases/edit.html.haml +9 -0
  126. data/app/views/purchases/index.html.haml +52 -0
  127. data/app/views/purchases/show.html.haml +32 -0
  128. data/app/views/sessions/new.html.haml +10 -0
  129. data/app/views/sessions/new_clerk.html.haml +22 -0
  130. data/app/views/shop/_groups.html.haml +8 -0
  131. data/app/views/shop/_menu.html.haml +5 -0
  132. data/app/views/shop/_sub.html.haml +0 -0
  133. data/app/views/shop/checkout.haml +142 -0
  134. data/app/views/shop/group.html.haml +9 -0
  135. data/app/views/shop/main_group.html.haml +9 -0
  136. data/app/views/shop/order.haml +104 -0
  137. data/app/views/shop/product.html.haml +67 -0
  138. data/app/views/shop/product_list.html.haml +50 -0
  139. data/app/views/shop/saved_search.html +6 -0
  140. data/app/views/shop/sub_group.html.haml +19 -0
  141. data/app/views/shop/tuotteista.html.haml +40 -0
  142. data/app/views/shop/welcome.html.haml +103 -0
  143. data/app/views/suppliers/edit.html.haml +10 -0
  144. data/app/views/suppliers/index.html.haml +40 -0
  145. data/app/views/suppliers/show.html.haml +27 -0
  146. data/bin/bundle +3 -0
  147. data/bin/rails +8 -0
  148. data/bin/rake +8 -0
  149. data/bin/rspec +7 -0
  150. data/bin/spring +18 -0
  151. data/config.ru +7 -0
  152. data/config/application.example.yml +13 -0
  153. data/config/application.rb +59 -0
  154. data/config/application.yml +13 -0
  155. data/config/boot.rb +7 -0
  156. data/config/database.yml +25 -0
  157. data/config/environment.rb +6 -0
  158. data/config/environments/development.rb +31 -0
  159. data/config/environments/production.rb +80 -0
  160. data/config/environments/test.rb +36 -0
  161. data/config/i18n-tasks.yml +11 -0
  162. data/config/initializers/attack.rb +32 -0
  163. data/config/initializers/backtrace_silencers.rb +7 -0
  164. data/config/initializers/filter_parameter_logging.rb +4 -0
  165. data/config/initializers/inflections.rb +16 -0
  166. data/config/initializers/migrate.rb +6 -0
  167. data/config/initializers/mime_types.rb +6 -0
  168. data/config/initializers/secret_token.rb +12 -0
  169. data/config/initializers/session_store.rb +3 -0
  170. data/config/initializers/simple_form.rb +149 -0
  171. data/config/initializers/simple_form_bootstrap.rb +48 -0
  172. data/config/initializers/wrap_parameters.rb +14 -0
  173. data/config/locales/config.yml +23 -0
  174. data/config/locales/en.yml +183 -0
  175. data/config/locales/fi.yml +211 -0
  176. data/config/routes.rb +108 -0
  177. data/db/migrate/20131224171442_clerks.rb +15 -0
  178. data/db/migrate/20131226110406_suppliers.rb +9 -0
  179. data/db/migrate/20131226143612_categories.rb +18 -0
  180. data/db/migrate/20131226143747_items.rb +14 -0
  181. data/db/migrate/20131226144134_orders.rb +21 -0
  182. data/db/migrate/20131226144316_baskets.rb +12 -0
  183. data/db/migrate/20131226151151_purchases.rb +11 -0
  184. data/db/migrate/20131226151332_products.rb +27 -0
  185. data/db/schema.rb +138 -0
  186. data/db/seeds.rb +4 -0
  187. data/lib/assets/.keep +0 -0
  188. data/lib/office_clerk.rb +20 -0
  189. data/lib/office_clerk/shipping_method.rb +35 -0
  190. data/lib/tasks/.keep +0 -0
  191. data/lib/tasks/import.rake +33 -0
  192. data/lib/templates/haml/scaffold/_form.html.haml +8 -0
  193. data/office_clerk.gemspec +46 -0
  194. data/public/404.html +58 -0
  195. data/public/422.html +58 -0
  196. data/public/500.html +57 -0
  197. data/public/favicon.ico +0 -0
  198. data/public/humans.txt +20 -0
  199. data/public/robots.txt +5 -0
  200. data/spec/controllers/baskets_controller_spec.rb +112 -0
  201. data/spec/controllers/categories_controller_spec.rb +133 -0
  202. data/spec/controllers/clerks_controller_spec.rb +70 -0
  203. data/spec/controllers/orders_controller_spec.rb +105 -0
  204. data/spec/controllers/products_controller_spec.rb +138 -0
  205. data/spec/controllers/purchases_controller_spec.rb +123 -0
  206. data/spec/controllers/sessions_controller_spec.rb +18 -0
  207. data/spec/controllers/suppliers_controller_spec.rb +137 -0
  208. data/spec/factories/addresses.rb +11 -0
  209. data/spec/factories/baskets.rb +15 -0
  210. data/spec/factories/categories.rb +8 -0
  211. data/spec/factories/clerks.rb +15 -0
  212. data/spec/factories/items.rb +19 -0
  213. data/spec/factories/orders.rb +9 -0
  214. data/spec/factories/products.rb +10 -0
  215. data/spec/factories/purchases.rb +10 -0
  216. data/spec/factories/suppliers.rb +7 -0
  217. data/spec/features/baskets/buttons_spec.rb +35 -0
  218. data/spec/features/baskets/edit_spec.rb +50 -0
  219. data/spec/features/baskets/index_spec.rb +12 -0
  220. data/spec/features/baskets/search_spec.rb +33 -0
  221. data/spec/features/baskets/show_spec.rb +21 -0
  222. data/spec/features/categories_spec.rb +21 -0
  223. data/spec/features/clerks_spec.rb +21 -0
  224. data/spec/features/orders_spec.rb +14 -0
  225. data/spec/features/products/index_spec.rb +30 -0
  226. data/spec/features/products/new_spec.rb +20 -0
  227. data/spec/features/purchases_spec.rb +14 -0
  228. data/spec/features/shops_spec.rb +18 -0
  229. data/spec/features/suppliers_spec.rb +18 -0
  230. data/spec/models/baskets/inventory_spec.rb +34 -0
  231. data/spec/models/baskets/items_spec.rb +37 -0
  232. data/spec/models/baskets/products_spec.rb +31 -0
  233. data/spec/models/category_spec.rb +18 -0
  234. data/spec/models/clerk/email_spec.rb +69 -0
  235. data/spec/models/clerk/password_spec.rb +83 -0
  236. data/spec/models/item_spec.rb +33 -0
  237. data/spec/models/locale_spec.rb +17 -0
  238. data/spec/models/order_spec.rb +19 -0
  239. data/spec/models/product_spec.rb +29 -0
  240. data/spec/models/purchase_spec.rb +8 -0
  241. data/spec/models/supplier_spec.rb +8 -0
  242. data/spec/routing/baskets_routing_spec.rb +35 -0
  243. data/spec/routing/categories_routing_spec.rb +35 -0
  244. data/spec/routing/orders_routing_spec.rb +35 -0
  245. data/spec/routing/products_routing_spec.rb +35 -0
  246. data/spec/routing/purchases_routing_spec.rb +35 -0
  247. data/spec/routing/suppliers_routing_spec.rb +35 -0
  248. data/spec/spec_helper.rb +74 -0
  249. data/spec/support/request_helper.rb +31 -0
  250. data/test/fixtures/baskets.yml +41993 -0
  251. data/test/fixtures/categories.yml +638 -0
  252. data/test/fixtures/clerks.yml +694 -0
  253. data/test/fixtures/items.yml +83651 -0
  254. data/test/fixtures/orders.yml +58918 -0
  255. data/test/fixtures/products.yml +110904 -0
  256. data/test/fixtures/purchases.yml +1755 -0
  257. data/test/fixtures/suppliers.yml +341 -0
  258. data/todo +8 -0
  259. metadata +607 -0
data/lib/tasks/.keep ADDED
File without changes
@@ -0,0 +1,33 @@
1
+ namespace :db do
2
+ desc "Load seed fixtures (from db/fixtures) into the current environment's database."
3
+ task :import => :environment do
4
+ from = "./../kauppa/"
5
+ require 'active_record/fixtures'
6
+ Dir.glob( "#{from}/*.yml").each do |file|
7
+ ActiveRecord::Fixtures.create_fixtures("#{from}", File.basename(file, '.*'))
8
+ end
9
+ puts Product.count
10
+ end
11
+
12
+ desc "Fix datestamps that were not done in conversion from spree (harmless but messes up reports)"
13
+ task :fix_dates => :environment do
14
+ updates = Order.all + Basket.all + Purchase.all
15
+ puts "Updates #{updates.length}"
16
+ updates.each do |update|
17
+ next if (update.created_at - update.updated_at ).abs > 1000000
18
+ update.update_column( :updated_at , update.created_at + 1.hour)
19
+ print "#{update.id} "
20
+ end
21
+ items = Item.all
22
+ puts "Items: #{items.length}"
23
+ items.each do |i|
24
+ print "#{i.id} "
25
+ if i.basket
26
+ i.update_column( :updated_at , i.basket.updated_at)
27
+ i.update_column( :created_at , i.basket.created_at)
28
+ else
29
+ i.delete
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,8 @@
1
+ <%= simple_form_for(@<%= singular_table_name %>) do |f| %>
2
+ <%= f.error_notification %>
3
+ .form-inputs
4
+ - attributes.each do |attribute|
5
+ <%= f.<%= attribute.reference? ? :association : :input %> :#{attribute.name} %>
6
+ .form-actions
7
+ <%= f.button :submit %>
8
+ <% end %>
@@ -0,0 +1,46 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |s|
6
+ s.platform = Gem::Platform::RUBY
7
+ s.name = 'office_clerk'
8
+ s.version = "0.0.1"
9
+ s.summary = 'Backend of rubyclerks'
10
+ s.description = s.summary
11
+ s.required_ruby_version = '>= 1.9.3'
12
+
13
+ s.authors = ['Torsten Rüger']
14
+ s.email = ['torsten@villataika.fi']
15
+ s.homepage = 'https://github.com/ruby_clerks/office_clerk'
16
+ s.license = 'MIT'
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- spec/*`.split("\n")
20
+ s.require_path = 'lib'
21
+ s.requirements << 'none'
22
+
23
+ s.has_rdoc = false
24
+
25
+ s.add_runtime_dependency 'rails', '~> 4.0.1'
26
+ s.add_runtime_dependency 'sass-rails'
27
+ s.add_runtime_dependency "haml"
28
+ s.add_runtime_dependency "jquery-rails"
29
+ s.add_runtime_dependency 'jquery-ui-rails'
30
+ s.add_runtime_dependency "kramdown"
31
+ s.add_runtime_dependency "will_paginate"
32
+
33
+ s.add_runtime_dependency 'simple_form'
34
+ s.add_runtime_dependency "prawn"
35
+ s.add_runtime_dependency 'will_paginate-bootstrap'
36
+ s.add_runtime_dependency 'bootstrap-sass', '~> 3.1.0'
37
+ s.add_runtime_dependency 'bootstrap_form'
38
+ s.add_runtime_dependency "paperclip"
39
+ s.add_runtime_dependency 'turbolinks'
40
+ s.add_runtime_dependency 'rails-i18n'
41
+
42
+ s.add_runtime_dependency "barby"
43
+ s.add_runtime_dependency "chunky_png"
44
+ s.add_runtime_dependency "bcrypt-ruby"
45
+
46
+ end
data/public/404.html ADDED
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
data/public/422.html ADDED
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
data/public/500.html ADDED
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
data/public/humans.txt ADDED
@@ -0,0 +1,20 @@
1
+ /* the humans responsible & colophon */
2
+ /* humanstxt.org */
3
+
4
+
5
+ /* TEAM */
6
+ <your title>: <your name>
7
+ Site:
8
+ Twitter:
9
+ Location:
10
+
11
+ /* THANKS */
12
+ Daniel Kehoe (@rails_apps) for the RailsApps project
13
+
14
+ /* SITE */
15
+ Standards: HTML5, CSS3
16
+ Components: jQuery
17
+ Software: Ruby on Rails
18
+
19
+ /* GENERATED BY */
20
+ RailsApps application template: http://railsapps.github.io/
data/public/robots.txt ADDED
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-agent: *
5
+ # Disallow: /
@@ -0,0 +1,112 @@
1
+ require 'spec_helper'
2
+
3
+ #Note of incompleteness:
4
+ # this is close to the original generated code and tests more crud than the actual basket functionality
5
+ # things are better in the features test (where adding item and the like is actually tested)
6
+
7
+ describe BasketsController do
8
+
9
+ # This should return the minimal set of values that should be in the session
10
+ # in order to pass any filters (e.g. authentication) defined in
11
+ # BasketsController. Be sure to keep this updated.
12
+ before :all do
13
+ create :admin unless Clerk.where(:admin => true).first
14
+ end
15
+ let(:valid_session) { { :clerk_email => Clerk.where(:admin => true).first.email } }
16
+
17
+ describe "GET index" do
18
+ it "assigns all baskets as @baskets" do
19
+ count_before = Basket.count
20
+ basket = create :basket
21
+ get :index, {}, valid_session
22
+ expect(assigns(:basket_scope).count).to be count_before + 1
23
+ end
24
+ end
25
+
26
+ describe "GET show" do
27
+ it "assigns the requested basket as @basket" do
28
+ basket = create :basket
29
+ get :show, {:id => basket.to_param}, valid_session
30
+ expect(assigns(:basket)).to eq(basket)
31
+ end
32
+ end
33
+
34
+ describe "GET new" do
35
+ it "assigns a new basket as @basket" do
36
+ get :new, {}, valid_session
37
+ expect(assigns(:basket)).to be_kind_of(Basket)
38
+ end
39
+ end
40
+
41
+ describe "GET edit" do
42
+ it "assigns the requested basket as @basket" do
43
+ basket = create :basket
44
+ get :edit, {:id => basket.to_param}, valid_session
45
+ expect(assigns(:basket)).to eq(basket)
46
+ end
47
+ end
48
+
49
+ describe "POST create" do
50
+ describe "with valid params" do
51
+ it "creates a new Basket" do
52
+ expect {
53
+ post :create, {:basket => attributes_for(:basket)}, valid_session
54
+ }.to change(Basket, :count).by(1)
55
+ end
56
+
57
+ it "assigns a newly created basket as @basket" do
58
+ post :create, {:basket => attributes_for(:basket)}, valid_session
59
+ expect(assigns(:basket)).to be_kind_of(Basket)
60
+ expect(assigns(:basket)).to be_persisted
61
+ end
62
+
63
+ it "redirects to the created basket" do
64
+ post :create, {:basket => attributes_for(:basket)}, valid_session
65
+ expect(response).to redirect_to(Basket.first)
66
+ end
67
+ end
68
+
69
+ end
70
+
71
+ describe "PUT update" do
72
+ describe "with valid params" do
73
+ it "assigns the requested basket as @basket" do
74
+ basket = create :basket
75
+ put :update, {:id => basket.to_param, :basket => attributes_for(:basket)}, valid_session
76
+ expect(assigns(:basket)).to eq(basket)
77
+ end
78
+
79
+ it "redirects to the basket" do
80
+ basket = create :basket
81
+ put :update, {:id => basket.to_param, :basket => attributes_for(:basket)}, valid_session
82
+ expect(response).to redirect_to( :action => :edit , :id => basket.id)
83
+ end
84
+ end
85
+
86
+ describe "with invalid params" do
87
+ it "assigns the basket as @basket" do
88
+ basket = create :basket
89
+ # Trigger the behavior that occurs when invalid params are submitted
90
+ allow_any_instance_of(Basket).to receive(:save).and_return(false)
91
+ put :update, {:id => basket.to_param, :basket => { :some => :thing_to_stop_erros }}, valid_session
92
+ expect(assigns(:basket)).to eq(basket)
93
+ end
94
+ end
95
+ end
96
+
97
+ describe "DELETE destroy" do
98
+ it "destroys the requested basket" do
99
+ basket = create :basket
100
+ expect {
101
+ delete :destroy, {:id => basket.to_param}, valid_session
102
+ }.to change(Basket, :count).by(-1)
103
+ end
104
+
105
+ it "redirects to the baskets list" do
106
+ basket = create :basket
107
+ delete :destroy, {:id => basket.to_param}, valid_session
108
+ expect(response).to redirect_to(baskets_path)
109
+ end
110
+ end
111
+
112
+ end
@@ -0,0 +1,133 @@
1
+ require 'spec_helper'
2
+
3
+ describe CategoriesController do
4
+
5
+ before :all do
6
+ create :admin unless Clerk.where(:admin => true).first
7
+ end
8
+
9
+ # This should return the minimal set of values that should be in the session
10
+ # in order to pass any filters (e.g. authentication) defined in
11
+ # SuppliersController. Be sure to keep this updated too.
12
+ let(:valid_session) { { :clerk_email => Clerk.where(:admin => true).first.email } }
13
+
14
+ describe "GET index" do
15
+ it "assigns all categories as @categories" do
16
+ category = create :category
17
+ get :index, {}, valid_session
18
+ # assigns(:categories).to eq([category])
19
+ end
20
+ end
21
+
22
+ describe "GET show" do
23
+ it "assigns the requested category as @category" do
24
+ category = create :category
25
+ get :show, {:id => category.to_param}, valid_session
26
+ expect(assigns(:category)).to eq(category)
27
+ end
28
+ end
29
+
30
+ describe "GET new" do
31
+ it "assigns a new category as @category" do
32
+ get :new, {}, valid_session
33
+ expect(assigns(:category)).to be_kind_of(Category)
34
+ end
35
+ end
36
+
37
+ describe "GET edit" do
38
+ it "assigns the requested category as @category" do
39
+ category = create :category
40
+ get :edit, {:id => category.to_param}, valid_session
41
+ expect(assigns(:category)).to eq(category)
42
+ end
43
+ end
44
+
45
+ describe "POST create" do
46
+ describe "with valid params" do
47
+ it "creates a new Category" do
48
+ expect {
49
+ post :create, {:category => attributes_for(:category)}, valid_session
50
+ }.to change(Category, :count).by(1)
51
+ end
52
+
53
+ it "assigns a newly created category as @category" do
54
+ post :create, {:category => attributes_for(:category)}, valid_session
55
+ expect(assigns(:category)).to be_kind_of(Category)
56
+ expect(assigns(:category)).to be_persisted
57
+ end
58
+
59
+ it "redirects to the created category" do
60
+ post :create, {:category => attributes_for(:category)}, valid_session
61
+ expect(response).to redirect_to(Category.unscoped.last)
62
+ end
63
+ end
64
+
65
+ describe "with invalid params" do
66
+ it "assigns a newly created but unsaved category as @category" do
67
+ # Trigger the behavior that occurs when invalid params are submitted
68
+ allow_any_instance_of(Category).to receive(:save).and_return(false)
69
+ post :create, {:category => { :name => ""}}, valid_session
70
+ expect(assigns(:category)).to be_kind_of(Category)
71
+ expect(assigns(:category)).to be_new_record
72
+ end
73
+
74
+ it "re-renders the 'new' template" do
75
+ # Trigger the behavior that occurs when invalid params are submitted
76
+ allow_any_instance_of(Category).to receive(:save).and_return(false)
77
+ post :create, {:category => { :name => ""}}, valid_session
78
+ expect(response).to render_template(:edit)
79
+ end
80
+ end
81
+ end
82
+
83
+ describe "PUT update" do
84
+ describe "with valid params" do
85
+
86
+ it "assigns the requested category as @category" do
87
+ category = create :category
88
+ put :update, {:id => category.to_param, :category => attributes_for(:category)}, valid_session
89
+ expect(assigns(:category)).to eq(category)
90
+ end
91
+
92
+ it "redirects to the category" do
93
+ category = create :category
94
+ put :update, {:id => category.to_param, :category => attributes_for(:category)}, valid_session
95
+ expect(response).to redirect_to(category)
96
+ end
97
+ end
98
+
99
+ describe "with invalid params" do
100
+ it "assigns the category as @category" do
101
+ category = create :category
102
+ # Trigger the behavior that occurs when invalid params are submitted
103
+ allow_any_instance_of(Category).to receive(:save).and_return(false)
104
+ put :update, {:id => category.to_param, :category => { :name => "" }}, valid_session
105
+ expect(assigns(:category)).to eq(category)
106
+ end
107
+
108
+ it "re-renders the 'edit' template" do
109
+ category = create :category
110
+ # Trigger the behavior that occurs when invalid params are submitted
111
+ allow_any_instance_of(Category).to receive(:save).and_return(false)
112
+ put :update, {:id => category.to_param, :category => { :name => ""}}, valid_session
113
+ expect(response).to render_template(:edit)
114
+ end
115
+ end
116
+ end
117
+
118
+ describe "DELETE destroy" do
119
+ it "destroys the requested category" do
120
+ category = create :category
121
+ expect {
122
+ delete :destroy, {:id => category.to_param}, valid_session
123
+ }.to change(Category, :count).by(-1)
124
+ end
125
+
126
+ it "redirects to the categories list" do
127
+ category = create :category
128
+ delete :destroy, {:id => category.to_param}, valid_session
129
+ expect(response).to redirect_to(categories_path)
130
+ end
131
+ end
132
+
133
+ end