kilt-cms 0.9.13 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -5
  3. data/app/controllers/kilt/kilt_controller.rb +1 -1
  4. data/app/views/kilt/form/{boolean.html.erb → _boolean.html.erb} +0 -0
  5. data/app/views/kilt/form/{datetime.html.erb → _datetime.html.erb} +0 -0
  6. data/app/views/kilt/form/{file.html.erb → _file.html.erb} +1 -1
  7. data/app/views/kilt/form/{html.html.erb → _html.html.erb} +0 -0
  8. data/app/views/kilt/form/{image.html.erb → _image.html.erb} +1 -1
  9. data/app/views/kilt/form/{longtext.html.erb → _longtext.html.erb} +0 -0
  10. data/app/views/kilt/form/{number.html.erb → _number.html.erb} +0 -0
  11. data/app/views/kilt/form/{select_one.html.erb → _select_one.html.erb} +0 -0
  12. data/app/views/kilt/form/{text.html.erb → _text.html.erb} +0 -0
  13. data/app/views/kilt/form/{vimeo.html.erb → _vimeo.html.erb} +0 -0
  14. data/app/views/kilt/form/{youtube.html.erb → _youtube.html.erb} +0 -0
  15. data/app/views/kilt/kilt/_form.html.erb +12 -10
  16. data/app/views/kilt/kilt/edit.html.erb +1 -1
  17. data/app/views/kilt/kilt/index.html.erb +3 -2
  18. data/app/views/kilt/kilt/list.html.erb +6 -9
  19. data/app/views/kilt/kilt/new.html.erb +1 -1
  20. data/app/views/layouts/kilt/cms/_menu.html.erb +2 -6
  21. data/lib/generators/kilt/backend_generator.rb +28 -6
  22. data/lib/generators/kilt/templates/backend/create_kilt_objects.rb +13 -0
  23. data/lib/generators/kilt/templates/backend/creds.yml.example +10 -5
  24. data/lib/generators/kilt/templates/backend/creds.yml.rethinkdb.example +22 -0
  25. data/lib/kilt.rb +34 -54
  26. data/lib/kilt/base.rb +3 -2
  27. data/lib/kilt/db/active_record.rb +50 -0
  28. data/lib/kilt/db/rethink_db.rb +108 -0
  29. data/lib/kilt/form.rb +7 -5
  30. data/lib/kilt/formatting.rb +39 -0
  31. data/lib/kilt/object.rb +32 -31
  32. data/lib/kilt/utils.rb +32 -39
  33. data/lib/kilt_object.rb +3 -0
  34. data/test/dummy/config/application.rb +1 -1
  35. data/test/dummy/config/database.yml +5 -0
  36. data/test/dummy/config/initializers/kilt.rb +1 -1
  37. data/test/dummy/config/kilt/config.yml +4 -13
  38. data/test/dummy/config/kilt/creds.yml +16 -11
  39. data/test/dummy/config/kilt/creds.yml.rethinkdb.example +22 -0
  40. data/test/dummy/config/routes.rb +1 -1
  41. data/test/dummy/db/migrate/20140519110428_create_kilt_objects.rb +13 -0
  42. data/test/dummy/db/schema.rb +29 -0
  43. data/test/dummy/log/development.log +551 -0
  44. data/test/dummy/public/uploads/image/timbo.jpg +0 -0
  45. data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  46. data/test/dummy/tmp/cache/assets/development/sprockets/18837248cb3274df9b7c6b0a5dcd56a5 +0 -0
  47. data/test/dummy/tmp/cache/assets/development/sprockets/20dffc9385ea740ceca470ee4e4b2197 +0 -0
  48. data/test/dummy/tmp/cache/assets/development/sprockets/23733156ea27da67211ba7ff763d76f0 +0 -0
  49. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  50. data/test/dummy/tmp/cache/assets/development/sprockets/3148655edeef1c319d57d0f9570acfd5 +0 -0
  51. data/test/dummy/tmp/cache/assets/development/sprockets/32ab48c63ad3bb6ddc1f419e51adb5db +0 -0
  52. data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  53. data/test/dummy/tmp/cache/assets/development/sprockets/36715e644093cfcb33ac795f3c9d66fe +0 -0
  54. data/test/dummy/tmp/cache/assets/development/sprockets/36f9a7f6f43adb582ac6eec43b58eb30 +0 -0
  55. data/test/dummy/tmp/cache/assets/development/sprockets/3d8ca1585ee95c5efb388645d66cf377 +0 -0
  56. data/test/dummy/tmp/cache/assets/development/sprockets/413be9c73d25c7febe933f4619da7cf8 +0 -0
  57. data/test/dummy/tmp/cache/assets/development/sprockets/4a935342c0113b534ad7622234965544 +0 -0
  58. data/test/dummy/tmp/cache/assets/development/sprockets/4b5c4a1edd3823a6a6c39e06b6eb230a +0 -0
  59. data/test/dummy/tmp/cache/assets/development/sprockets/4c5736bf0bd429296d1a32930364897e +0 -0
  60. data/test/dummy/tmp/cache/assets/development/sprockets/4f26158b7a804a3e3c47ce0ceff2798c +0 -0
  61. data/test/dummy/tmp/cache/assets/development/sprockets/542fc810f9cd36e7bed9a3e5e9670995 +0 -0
  62. data/test/dummy/tmp/cache/assets/development/sprockets/56f1e7d57d31bf3315e1e33732d57faa +0 -0
  63. data/test/dummy/tmp/cache/assets/development/sprockets/5bea4c2d87ec725262213ed51575b485 +0 -0
  64. data/test/dummy/tmp/cache/assets/development/sprockets/6b6e86e81f5e8f80bb2b3d1e8f7ed7f3 +0 -0
  65. data/test/dummy/tmp/cache/assets/development/sprockets/6c2ddc22c04321c269de383e37cb519b +0 -0
  66. data/test/dummy/tmp/cache/assets/development/sprockets/7035e5c60f5da3b7fc12c472677483d0 +0 -0
  67. data/test/dummy/tmp/cache/assets/development/sprockets/704c682957c2beb38a1927ddb66cc557 +0 -0
  68. data/test/dummy/tmp/cache/assets/development/sprockets/74b6c3e00222b8bf31b0ecf50fcb0d38 +0 -0
  69. data/test/dummy/tmp/cache/assets/development/sprockets/91021bdb7ebb3d4f6fdf4e49909d4c07 +0 -0
  70. data/test/dummy/tmp/cache/assets/development/sprockets/914095efd3b33401a7f29f9fb05d72d6 +0 -0
  71. data/test/dummy/tmp/cache/assets/development/sprockets/9dd98bca318fb820a8451cafce020588 +0 -0
  72. data/test/dummy/tmp/cache/assets/development/sprockets/9f2c00a36b5b8c713a797b508c778a65 +0 -0
  73. data/test/dummy/tmp/cache/assets/development/sprockets/a88ab4e49bb7203b8e0586c38efdd2b0 +0 -0
  74. data/test/dummy/tmp/cache/assets/development/sprockets/acfc15d25fde8b933b06c91324755751 +0 -0
  75. data/test/dummy/tmp/cache/assets/development/sprockets/c0671678b70011547b80da0669d031cc +0 -0
  76. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  77. data/test/dummy/tmp/cache/assets/development/sprockets/d6973c1d43f8ca41b98a6b640fda2616 +0 -0
  78. data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  79. data/test/dummy/tmp/cache/assets/development/sprockets/dc676330961fd22be77c48cb77ec065f +0 -0
  80. data/test/dummy/tmp/cache/assets/development/sprockets/ddc29f2c13cd99d017fd526b61dcb951 +0 -0
  81. data/test/dummy/tmp/cache/assets/development/sprockets/de45247cb814cafe20e9e46c79e470fe +0 -0
  82. data/test/dummy/tmp/cache/assets/development/sprockets/df0b7c3ac590a286561806e813c2974f +0 -0
  83. data/test/dummy/tmp/cache/assets/development/sprockets/dfa8b85e3c1273b7e69839e4e607c3e1 +0 -0
  84. data/test/dummy/tmp/cache/assets/development/sprockets/e22d705d0c889ec4837f183a9beec0f3 +0 -0
  85. data/test/dummy/tmp/cache/assets/development/sprockets/e3a4ad3549e1e57d03698a36daeff406 +0 -0
  86. data/test/dummy/tmp/cache/assets/development/sprockets/ef7c8ce46dfc9e9087ce84dbdfdd0011 +0 -0
  87. data/test/dummy/tmp/cache/assets/development/sprockets/f4b5dd06a6113950c0f481cbc5a31a66 +0 -0
  88. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  89. data/test/dummy/tmp/data/meta_request/1c3d4a4b-d7e1-4126-8bfc-572acbc2f675.json +1 -0
  90. data/test/dummy/tmp/data/meta_request/449ff78e-30d2-4cc5-bbb7-3397d04a4c46.json +1 -0
  91. data/test/dummy/tmp/data/meta_request/5974cfb9-99bd-4d5c-a4e1-6e352ecd2dd8.json +1 -0
  92. data/test/dummy/tmp/data/meta_request/960de12b-b1c5-4d44-937b-e3d8c00d682c.json +1 -0
  93. data/test/dummy/tmp/data/meta_request/9df9ad77-1b70-4fb7-ad18-f31f28c60c6c.json +1 -0
  94. data/test/dummy/tmp/data/meta_request/a5374758-4e16-487a-ab11-9a69a1abed2e.json +1 -0
  95. data/test/dummy/tmp/data/meta_request/a65d97b2-df1f-445e-99d5-615c4db5c4e1.json +1 -0
  96. data/test/dummy/tmp/data/meta_request/b3693c6f-23cd-4afe-ae82-38078eaa643a.json +1 -0
  97. data/test/dummy/tmp/data/meta_request/daa1c80a-bad3-4bc1-8f67-d586979cbedc.json +1 -0
  98. data/test/dummy/tmp/data/meta_request/e2e7621f-08e5-46dd-83c2-b87eb6d5fd45.json +1 -0
  99. data/test/empty.sqlite3 +0 -0
  100. data/test/generators/kilt/backend_generator_spec.rb +70 -0
  101. data/test/kilt/form_spec.rb +40 -51
  102. data/test/kilt/formatting_spec.rb +66 -0
  103. data/test/kilt/object_spec.rb +204 -0
  104. data/test/kilt/utils_spec.rb +147 -0
  105. data/test/kilt_object_spec.rb +12 -0
  106. data/test/kilt_spec.rb +422 -0
  107. data/test/minitest_helper.rb +58 -0
  108. metadata +164 -66
  109. data/test/dummy/tmp/data/meta_request/191f094a-5e87-4654-bc80-5acb51d3f903.json +0 -1
  110. data/test/dummy/tmp/data/meta_request/1eb9499d-2e84-47df-ac0a-da308031aa3a.json +0 -1
  111. data/test/dummy/tmp/data/meta_request/300cabd2-6e51-4b1b-ab55-a072049c2a0f.json +0 -1
  112. data/test/dummy/tmp/data/meta_request/3ec7ea74-e7a7-4f4d-9434-e08edfc12b8a.json +0 -1
  113. data/test/dummy/tmp/data/meta_request/5bb81411-321e-4cba-9ffa-87fcd8105ef4.json +0 -1
  114. data/test/dummy/tmp/data/meta_request/9d6e10c1-5b14-4199-852e-9f1e97132b8f.json +0 -1
  115. data/test/dummy/tmp/data/meta_request/a6403ed9-21f1-4a00-9725-4a1c544214f6.json +0 -1
  116. data/test/dummy/tmp/data/meta_request/b4487e0b-0a08-40a3-a364-e715e6765631.json +0 -1
  117. data/test/dummy/tmp/data/meta_request/d399f913-d3a5-4de3-b012-848377a702fc.json +0 -1
  118. data/test/dummy/tmp/data/meta_request/dcf95267-1855-4062-85c8-e880f8d62443.json +0 -1
@@ -0,0 +1 @@
1
+ [{"name":"render_template.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/kilt/index.html.erb","layout":"layouts/kilt/cms"},"time":"2014-05-19T11:03:46-04:00","transaction_id":"a76f352251dff5f29bfb","end":"2014-05-19T11:03:46-04:00","children":[],"duration":1.214},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/layouts/kilt/cms/_menu.html.erb"},"time":"2014-05-19T11:03:46-04:00","transaction_id":"a76f352251dff5f29bfb","end":"2014-05-19T11:03:46-04:00","children":[],"duration":11.540999999999999},{"name":"process_action.action_controller","payload":{"controller":"Kilt::KiltController","action":"index","params":{"controller":"kilt/kilt","action":"index"},"format":"html","method":"GET","path":"/admin/","status":200,"view_runtime":147.536,"db_runtime":0},"time":"2014-05-19T11:03:46-04:00","transaction_id":"a76f352251dff5f29bfb","end":"2014-05-19T11:03:46-04:00","children":[],"duration":149.518}]
@@ -0,0 +1 @@
1
+ [{"name":"render_template.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/test/dummy/app/views/dummy/index.html.erb","layout":"layouts/application"},"time":"2014-05-19T11:03:06-04:00","transaction_id":"a76f352251dff5f29bfb","end":"2014-05-19T11:03:06-04:00","children":[],"duration":2.8609999999999998},{"name":"process_action.action_controller","payload":{"controller":"DummyController","action":"index","params":{"controller":"dummy","action":"index"},"format":"html","method":"GET","path":"/","status":200,"view_runtime":161.163,"db_runtime":0},"time":"2014-05-19T11:03:06-04:00","transaction_id":"a76f352251dff5f29bfb","end":"2014-05-19T11:03:06-04:00","children":[],"duration":162.992}]
@@ -0,0 +1 @@
1
+ [{"name":"sql.active_record","payload":{"sql":" SELECT attr.attname\n FROM pg_attribute attr\n INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1]\n WHERE cons.contype = 'p'\n AND cons.conrelid = '\"kilt_objects\"'::regclass\n","name":"SCHEMA","connection_id":70322876756840,"binds":[]},"time":"2014-05-19T11:06:22-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:06:22-04:00","children":[],"duration":1.8840000000000001},{"name":"sql.active_record","payload":{"sql":"SELECT \"kilt_objects\".* FROM \"kilt_objects\" WHERE \"kilt_objects\".\"slug\" = 'test-bagpipe' ORDER BY \"kilt_objects\".\"id\" ASC LIMIT 1","name":"KiltObject Load","connection_id":70322876756840,"binds":[]},"time":"2014-05-19T11:06:22-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:06:22-04:00","children":[],"duration":1.6800000000000002},{"name":"sql.active_record","payload":{"sql":"BEGIN","name":null,"connection_id":70322876756840,"binds":[]},"time":"2014-05-19T11:06:22-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.6},{"name":"sql.active_record","payload":{"sql":"SHOW search_path","name":"SCHEMA","connection_id":70322876756840,"binds":[]},"time":"2014-05-19T11:06:22-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.326},{"name":"sql.active_record","payload":{"sql":"INSERT INTO \"kilt_objects\" (\"created_at\", \"data\", \"object_type\", \"slug\", \"unique_id\", \"updated_at\") VALUES ($1, $2, $3, $4, $5, $6) RETURNING \"id\"","name":"SQL","connection_id":70322876756840,"binds":[[{"oid_type":{},"array":false,"name":"created_at","sql_type":"timestamp without time zone","null":true,"limit":null,"precision":null,"scale":null,"type":"datetime","default":null,"default_function":null,"primary":false,"coder":null},"2014-05-19T15:06:22.183Z"],[{"oid_type":{},"array":false,"name":"data","sql_type":"text","null":true,"limit":null,"precision":null,"scale":null,"type":"text","default":null,"default_function":null,"primary":false,"coder":null},"---\nname: Test Bagpipe\nweight: '12121'\ndescription: dsfaafsdf\nmarkup: \u003Cpre\u003Ehi\u003C/pre\u003E\nbirthday: ''\nhas_stuff: 'true'\npick_one: Green\nimage: timbo.jpg\nvimeo_video: ''\nyoutube_video: l3HYLLruJis\nupdated_at: 2014-05-19 11:06:22.168922000 -04:00\ncreated_at: 2014-05-19 11:06:22.168922000 -04:00\nunique_id: '1400511982168'\ntype: bagpipe\nslug: test-bagpipe\n"],[{"oid_type":{},"array":false,"name":"object_type","sql_type":"character varying(255)","null":true,"limit":255,"precision":null,"scale":null,"type":"string","default":null,"default_function":null,"primary":false,"coder":null},"bagpipe"],[{"oid_type":{},"array":false,"name":"slug","sql_type":"character varying(255)","null":true,"limit":255,"precision":null,"scale":null,"type":"string","default":null,"default_function":null,"primary":false,"coder":null},"test-bagpipe"],[{"oid_type":{},"array":false,"name":"unique_id","sql_type":"character varying(255)","null":true,"limit":255,"precision":null,"scale":null,"type":"string","default":null,"default_function":null,"primary":false,"coder":null},"1400511982168"],[{"oid_type":{},"array":false,"name":"updated_at","sql_type":"timestamp without time zone","null":true,"limit":null,"precision":null,"scale":null,"type":"datetime","default":null,"default_function":null,"primary":false,"coder":null},"2014-05-19T15:06:22.183Z"]]},"time":"2014-05-19T11:06:22-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:06:22-04:00","children":[],"duration":7.106000000000001},{"name":"sql.active_record","payload":{"sql":"COMMIT","name":null,"connection_id":70322876756840,"binds":[]},"time":"2014-05-19T11:06:22-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.784},{"name":"process_action.action_controller","payload":{"controller":"Kilt::KiltController","action":"create","params":{"utf8":"✓","authenticity_token":"RiORy2iVlpvfltHE/P5yImpHPiMX/xd4gz95hgcpx3c=","bagpipe":{"name":"Test Bagpipe","weight":"12121","description":"dsfaafsdf","markup":"\u003Cpre\u003Ehi\u003C/pre\u003E","birthday":"","has_stuff":"true","pick_one":"Green","image":{"tempfile":[],"original_filename":"timbo.jpg","content_type":"image/jpeg","headers":"Content-Disposition: form-data; name=\"bagpipe[image]\"; filename=\"timbo.jpg\"\r\nContent-Type: image/jpeg\r\n"},"image-hidden":"","vimeo_video":"","youtube_video":"l3HYLLruJis","other-hidden":""},"controller":"kilt/kilt","action":"create","types":"bagpipes"},"format":"html","method":"POST","path":"/admin/bagpipes","status":302,"view_runtime":null,"db_runtime":10.779},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":34.82}]
@@ -0,0 +1 @@
1
+ [{"name":"sql.active_record","payload":{"sql":"SELECT \"kilt_objects\".* FROM \"kilt_objects\" WHERE \"kilt_objects\".\"slug\" = 'test-bagpipe' ORDER BY \"kilt_objects\".\"id\" ASC LIMIT 1","name":"KiltObject Load","connection_id":70322876756840,"binds":[]},"time":"2014-05-19T11:06:22-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:06:22-04:00","children":[],"duration":1.3079999999999998},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_text.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.096},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_number.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.12000000000000001},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_longtext.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.101},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_html.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.102},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_datetime.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.081},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_boolean.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.171},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_select_one.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.191},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_image.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.44499999999999995},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_vimeo.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.25},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_youtube.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.256},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_file.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.145},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/kilt/_form.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":44.101},{"name":"render_template.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/kilt/edit.html.erb","layout":"layouts/kilt/cms"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":46.92},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/layouts/kilt/cms/_menu.html.erb"},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":0.983},{"name":"process_action.action_controller","payload":{"controller":"Kilt::KiltController","action":"edit","params":{"controller":"kilt/kilt","action":"edit","types":"bagpipes","slug":"test-bagpipe"},"format":"html","method":"GET","path":"/admin/bagpipes/test-bagpipe","status":200,"view_runtime":54.452,"db_runtime":1.0219999999999998},"time":"2014-05-19T11:06:22-04:00","transaction_id":"6aa7dddc246dd37d5071","end":"2014-05-19T11:06:22-04:00","children":[],"duration":61.633}]
@@ -0,0 +1 @@
1
+ [{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_text.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":0.48899999999999993},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_number.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":0.51},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_longtext.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":0.406},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_html.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":0.441},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_datetime.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":0.388},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_boolean.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":0.6859999999999999},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_select_one.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":0.6719999999999999},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_image.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":1.1460000000000001},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_vimeo.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":1.375},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_youtube.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":1.408},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/form/_file.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":1.135},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/kilt/_form.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":25.355},{"name":"render_template.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/kilt/new.html.erb","layout":"layouts/kilt/cms"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":27.382},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/layouts/kilt/cms/_menu.html.erb"},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":1.1219999999999999},{"name":"process_action.action_controller","payload":{"controller":"Kilt::KiltController","action":"new","params":{"controller":"kilt/kilt","action":"new","types":"bagpipe"},"format":"html","method":"GET","path":"/admin/bagpipe/new","status":200,"view_runtime":35.391,"db_runtime":0},"time":"2014-05-19T11:05:17-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:17-04:00","children":[],"duration":38.096}]
@@ -0,0 +1 @@
1
+ [{"name":"sql.active_record","payload":{"sql":"SELECT \"kilt_objects\".* FROM \"kilt_objects\" WHERE \"kilt_objects\".\"object_type\" = 'bagpipe'","name":"KiltObject Load","connection_id":70322876756840,"binds":[]},"time":"2014-05-19T11:06:29-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:06:29-04:00","children":[],"duration":0.76},{"name":"render_template.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/kilt/list.html.erb","layout":"layouts/kilt/cms"},"time":"2014-05-19T11:06:29-04:00","transaction_id":"a871f0abb5ffc1960101","end":"2014-05-19T11:06:29-04:00","children":[],"duration":9.479},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/layouts/kilt/cms/_menu.html.erb"},"time":"2014-05-19T11:06:29-04:00","transaction_id":"a871f0abb5ffc1960101","end":"2014-05-19T11:06:29-04:00","children":[],"duration":1.246},{"name":"process_action.action_controller","payload":{"controller":"Kilt::KiltController","action":"list","params":{"controller":"kilt/kilt","action":"list","types":"bagpipe"},"format":"html","method":"GET","path":"/admin/bagpipe","status":200,"view_runtime":17.207,"db_runtime":0.612},"time":"2014-05-19T11:06:29-04:00","transaction_id":"a871f0abb5ffc1960101","end":"2014-05-19T11:06:29-04:00","children":[],"duration":23.321}]
@@ -0,0 +1 @@
1
+ [{"name":"sql.active_record","payload":{"sql":" SELECT COUNT(*)\n FROM pg_class c\n LEFT JOIN pg_namespace n ON n.oid = c.relnamespace\n WHERE c.relkind in ('v','r')\n AND c.relname = 'kilt_objects'\n AND n.nspname = ANY (current_schemas(false))\n","name":"SCHEMA","connection_id":70255357268300,"binds":[]},"time":"2014-05-19T11:03:48-04:00","transaction_id":"a76f352251dff5f29bfb","end":"2014-05-19T11:03:48-04:00","children":[],"duration":11.166},{"name":"sql.active_record","payload":{"sql":"SELECT \"kilt_objects\".* FROM \"kilt_objects\" WHERE \"kilt_objects\".\"object_type\" = 'bagpipe'","name":"KiltObject Load","connection_id":70255357268300,"binds":[],"exception":["PG::UndefinedTable","ERROR: relation \"kilt_objects\" does not exist\nLINE 1: SELECT \"kilt_objects\".* FROM \"kilt_objects\" WHERE \"kilt_obj...\n ^\n"]},"time":"2014-05-19T11:03:48-04:00","transaction_id":"a76f352251dff5f29bfb","end":"2014-05-19T11:03:48-04:00","children":[],"duration":1.5410000000000001},{"name":"process_action.action_controller","payload":{"controller":"Kilt::KiltController","action":"list","params":{"controller":"kilt/kilt","action":"list","types":"bagpipes"},"format":"html","method":"GET","path":"/admin/bagpipes","exception":["ActiveRecord::StatementInvalid","PG::UndefinedTable: ERROR: relation \"kilt_objects\" does not exist\nLINE 1: SELECT \"kilt_objects\".* FROM \"kilt_objects\" WHERE \"kilt_obj...\n ^\n: SELECT \"kilt_objects\".* FROM \"kilt_objects\" WHERE \"kilt_objects\".\"object_type\" = 'bagpipe'"],"status":"500"},"time":"2014-05-19T11:03:48-04:00","transaction_id":"a76f352251dff5f29bfb","end":"2014-05-19T11:03:48-04:00","children":[],"duration":21.455},{"name":"process_action.action_controller.exception","payload":{"call":"ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation \"kilt_objects\" does not exist\nLINE 1: SELECT \"kilt_objects\".* FROM \"kilt_objects\" WHERE \"kilt_obj...\n ^\n: SELECT \"kilt_objects\".* FROM \"kilt_objects\" WHERE \"kilt_objects\".\"object_type\" = 'bagpipe')"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/postgresql_adapter.rb:774:in `async_exec'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/postgresql_adapter.rb:774:in `exec_no_cache'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:138:in `block in exec_query'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/abstract_adapter.rb:435:in `block in log'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/abstract_adapter.rb:430:in `log'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/postgresql_adapter.rb:891:in `select'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/abstract/database_statements.rb:24:in `select_all'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `block in select_all'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/abstract/query_cache.rb:76:in `cache_sql'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `select_all'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/querying.rb:36:in `find_by_sql'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/relation.rb:585:in `exec_queries'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/relation.rb:471:in `load'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/relation.rb:220:in `to_a'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/relation/delegation.rb:12:in `map'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"/Users/tim/Sites/Kilt/lib/kilt/db/active_record.rb:14:in `find_all_by_type'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"/Users/tim/Sites/Kilt/lib/kilt.rb:80:in `get_collection'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"/Users/tim/Sites/Kilt/lib/kilt.rb:24:in `method_missing'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"/Users/tim/Sites/Kilt/app/controllers/kilt/kilt_controller.rb:24:in `list'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/abstract_controller/base.rb:189:in `process_action'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_controller/metal/rendering.rb:10:in `process_action'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/abstract_controller/callbacks.rb:18:in `block in process_action'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/callbacks.rb:413:in `_run__3513902130905207298__process_action__callbacks'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/callbacks.rb:80:in `run_callbacks'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/abstract_controller/callbacks.rb:17:in `process_action'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_controller/metal/rescue.rb:29:in `process_action'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/notifications.rb:159:in `block in instrument'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/notifications.rb:159:in `instrument'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/abstract_controller/base.rb:136:in `process'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/abstract_controller/rendering.rb:44:in `process'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_controller/metal.rb:195:in `dispatch'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_controller/metal.rb:231:in `block in action'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/routing/route_set.rb:80:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/routing/route_set.rb:48:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/journey/router.rb:71:in `block in call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/journey/router.rb:59:in `each'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/journey/router.rb:59:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/routing/route_set.rb:680:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"railties (4.0.1) lib/rails/engine.rb:511:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"railties (4.0.1) lib/rails/railtie/configurable.rb:30:in `method_missing'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/journey/router.rb:71:in `block in call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/journey/router.rb:59:in `each'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/journey/router.rb:59:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/routing/route_set.rb:680:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"meta_request (0.2.8) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack-contrib (1.1.0) lib/rack/contrib/response_headers.rb:17:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"meta_request (0.2.8) lib/meta_request/middlewares/headers.rb:16:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"meta_request (0.2.8) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/etag.rb:23:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/head.rb:11:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/middleware/flash.rb:241:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/middleware/cookies.rb:486:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/query_cache.rb:36:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activerecord (4.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/callbacks.rb:373:in `_run__4248329420754934168__call__callbacks'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/callbacks.rb:80:in `run_callbacks'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/middleware/reloader.rb:64:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"better_errors (1.0.1) lib/better_errors/middleware.rb:84:in `protected_app_call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"better_errors (1.0.1) lib/better_errors/middleware.rb:79:in `better_errors_call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"better_errors (1.0.1) lib/better_errors/middleware.rb:56:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"railties (4.0.1) lib/rails/rack/logger.rb:38:in `call_app'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"railties (4.0.1) lib/rails/rack/logger.rb:20:in `block in call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/tagged_logging.rb:67:in `block in tagged'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/tagged_logging.rb:25:in `tagged'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/tagged_logging.rb:67:in `tagged'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"railties (4.0.1) lib/rails/rack/logger.rb:20:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/runtime.rb:17:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"activesupport (4.0.1) lib/active_support/cache/strategy/local_cache.rb:83:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/lock.rb:17:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"actionpack (4.0.1) lib/action_dispatch/middleware/static.rb:64:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/sendfile.rb:112:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"railties (4.0.1) lib/rails/engine.rb:511:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"railties (4.0.1) lib/rails/application.rb:97:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/lock.rb:17:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/content_length.rb:14:in `call'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"/Users/tim/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"/Users/tim/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0},{"name":"process_action.action_controller.exception","payload":{"call":"/Users/tim/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'"},"time":0,"transaction_id":null,"end":0,"children":[],"duration":0.0}]
@@ -0,0 +1 @@
1
+ [{"name":"process_action.action_controller","payload":{"controller":"Kilt::KiltController","action":"index","params":{"controller":"kilt/kilt","action":"index"},"format":"html","method":"GET","path":"/admin/","status":401,"view_runtime":null,"db_runtime":0},"time":"2014-05-19T11:03:26-04:00","transaction_id":"a76f352251dff5f29bfb","end":"2014-05-19T11:03:26-04:00","children":[],"duration":2.269}]
@@ -0,0 +1 @@
1
+ [{"name":"process_action.action_controller","payload":{"controller":"Kilt::KiltController","action":"index","params":{"controller":"kilt/kilt","action":"index"},"format":"html","method":"GET","path":"/admin/","status":401,"view_runtime":null,"db_runtime":0},"time":"2014-05-19T11:03:27-04:00","transaction_id":"a76f352251dff5f29bfb","end":"2014-05-19T11:03:27-04:00","children":[],"duration":1.761}]
@@ -0,0 +1 @@
1
+ [{"name":"sql.active_record","payload":{"sql":" SELECT COUNT(*)\n FROM pg_class c\n LEFT JOIN pg_namespace n ON n.oid = c.relnamespace\n WHERE c.relkind in ('v','r')\n AND c.relname = 'kilt_objects'\n AND n.nspname = ANY (current_schemas(false))\n","name":"SCHEMA","connection_id":70322876756840,"binds":[]},"time":"2014-05-19T11:05:14-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:14-04:00","children":[],"duration":5.3229999999999995},{"name":"sql.active_record","payload":{"sql":" SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod\n FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '\"kilt_objects\"'::regclass\n AND a.attnum \u003E 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n","name":"SCHEMA","connection_id":70322876756840,"binds":[]},"time":"2014-05-19T11:05:14-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:14-04:00","children":[],"duration":4.481},{"name":"sql.active_record","payload":{"sql":"SELECT \"kilt_objects\".* FROM \"kilt_objects\" WHERE \"kilt_objects\".\"object_type\" = 'bagpipe'","name":"KiltObject Load","connection_id":70322876756840,"binds":[]},"time":"2014-05-19T11:05:14-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:14-04:00","children":[],"duration":1.712},{"name":"render_template.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/kilt/kilt/list.html.erb","layout":"layouts/kilt/cms"},"time":"2014-05-19T11:05:14-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:14-04:00","children":[],"duration":15.481},{"name":"render_partial.action_view","payload":{"identifier":"/Users/tim/Sites/Kilt/app/views/layouts/kilt/cms/_menu.html.erb"},"time":"2014-05-19T11:05:14-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:14-04:00","children":[],"duration":3.159},{"name":"process_action.action_controller","payload":{"controller":"Kilt::KiltController","action":"list","params":{"controller":"kilt/kilt","action":"list","types":"bagpipes"},"format":"html","method":"GET","path":"/admin/bagpipes","status":200,"view_runtime":85.804,"db_runtime":10.889},"time":"2014-05-19T11:05:14-04:00","transaction_id":"daba1d9b56547f1a3795","end":"2014-05-19T11:05:14-04:00","children":[],"duration":107.481}]
Binary file
@@ -0,0 +1,70 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../minitest_helper')
2
+ require 'rails/generators'
3
+ require_relative '../../../lib/generators/kilt/backend_generator'
4
+
5
+ describe Kilt::Generators::BackendGenerator do
6
+
7
+ describe "generate" do
8
+
9
+ let(:generator) { Kilt::Generators::BackendGenerator.new }
10
+
11
+ let(:root) do
12
+ Object.new
13
+ end
14
+
15
+ let(:parent_name) { 'Test' }
16
+
17
+ before do
18
+ generator.stubs(:template)
19
+ generator.stubs(:copy_file)
20
+ generator.stubs(:inject_into_file)
21
+
22
+ Rails.stubs(:root).returns root
23
+
24
+ root.stubs(:join)
25
+
26
+ application = Object.new
27
+ klass = Object.new
28
+ Rails.stubs(:application).returns application
29
+ application.stubs(:class).returns klass
30
+ klass.stubs(:parent_name).returns parent_name
31
+ end
32
+
33
+ it "should copy the default config file to the app" do
34
+ root_result = Object.new
35
+ root.stubs(:join).with('config', 'kilt', 'config.yml').returns root_result
36
+ generator.expects(:template).with 'config.yml.erb', root_result
37
+ generator.generate
38
+ end
39
+
40
+ it "should copy the default credential file to the app" do
41
+ root_result = Object.new
42
+ root.stubs(:join).with('config', 'kilt', 'creds.yml').returns root_result
43
+ generator.expects(:copy_file).with 'creds.yml.example', root_result
44
+ generator.generate
45
+ end
46
+
47
+ it "should copy the rethinkdb credential file to the app" do
48
+ root_result = Object.new
49
+ root.stubs(:join).with('config', 'kilt', 'creds.yml.rethinkdb.example').returns root_result
50
+ generator.expects(:copy_file).with 'creds.yml.rethinkdb.example', root_result
51
+ generator.generate
52
+ end
53
+
54
+ it "should copy the kilt.rb file as an app initializer" do
55
+ root_result = Object.new
56
+ root.stubs(:join).with('config', 'initializers', 'kilt.rb').returns root_result
57
+ generator.expects(:copy_file).with 'kilt.rb', root_result
58
+ generator.generate
59
+ end
60
+
61
+ it "should inject the Kilt routes into the app's routes" do
62
+ root_result = Object.new
63
+ root.stubs(:join).with('config', 'routes.rb').returns root_result
64
+ generator.expects(:inject_into_file).with root_result, "\n\tmount Kilt::Engine => '/admin', as: 'kilt_engine'\n", :after => ".routes.draw do\n"
65
+ generator.generate
66
+ end
67
+
68
+ end
69
+
70
+ end
@@ -8,33 +8,28 @@ describe Kilt::Form do
8
8
 
9
9
  describe "when the view exists" do
10
10
 
11
- it "should return a rendered action view" do
12
-
13
- rendered_action_view = Object.new
11
+ it "should return the content of the view" do
14
12
 
15
13
  object = Object.new
16
14
  field_name = Object.new
17
15
  index = Object.new
18
16
  options = Object.new
17
+ view = Object.new
18
+
19
+ html = Object.new
20
+
21
+ view.stubs(:render).with( { partial: "kilt/form/#{method}",
22
+ locals: {
23
+ object: object,
24
+ field_name: field_name,
25
+ index: index,
26
+ options: options,
27
+ view: view
28
+ } } ).returns html
19
29
 
20
- action_view = Object.new
21
- action_view.expects(:render)
22
- .with(:file => "#{method}.html.erb",
23
- :locals => {
24
- :object => object,
25
- :field_name => field_name,
26
- :index => index,
27
- :options => options
28
- } )
29
- .returns rendered_action_view
30
-
31
- ActionView::Base.stubs(:new)
32
- .with(Kilt::Form::TEMPLATES_DIR)
33
- .returns action_view
34
-
35
- result = Kilt::Form.send(method.to_sym, object, field_name, index, options)
30
+ result = Kilt::Form.send(method.to_sym, object, field_name, index, view, options)
36
31
 
37
- result.must_be_same_as rendered_action_view
32
+ result.must_be_same_as html
38
33
 
39
34
  end
40
35
 
@@ -42,43 +37,37 @@ describe Kilt::Form do
42
37
 
43
38
  describe "when the view does not exist" do
44
39
 
45
- it "should return the default view" do
46
-
47
- rendered_action_view = Object.new
40
+ it "should return the content of the default view" do
48
41
 
49
42
  object = Object.new
50
43
  field_name = Object.new
51
44
  index = Object.new
52
45
  options = Object.new
53
-
54
- action_view = Object.new
55
- action_view.expects(:render)
56
- .with(:file => "#{method}.html.erb",
57
- :locals => {
58
- :object => object,
59
- :field_name => field_name,
60
- :index => index,
61
- :options => options
62
- } )
63
- .raises 'error'
64
-
65
- action_view.expects(:render)
66
- .with(:file => "_default.html.erb",
67
- :locals => {
68
- :object => object,
69
- :field_name => field_name,
70
- :index => index,
71
- :options => options
72
- } )
73
- .returns rendered_action_view
74
-
75
- ActionView::Base.stubs(:new)
76
- .with(Kilt::Form::TEMPLATES_DIR)
77
- .returns action_view
78
-
79
- result = Kilt::Form.send(method.to_sym, object, field_name, index, options)
46
+ view = Object.new
47
+
48
+ html = Object.new
49
+
50
+ view.stubs(:render).with( { partial: "kilt/form/#{method}",
51
+ locals: {
52
+ object: object,
53
+ field_name: field_name,
54
+ index: index,
55
+ options: options,
56
+ view: view
57
+ } } ).raises 'error'
58
+
59
+ view.stubs(:render).with( { partial: "kilt/form/default",
60
+ locals: {
61
+ object: object,
62
+ field_name: field_name,
63
+ index: index,
64
+ options: options,
65
+ view: view
66
+ } } ).returns html
67
+
68
+ result = Kilt::Form.send(method.to_sym, object, field_name, index, view, options)
80
69
 
81
- result.must_be_same_as rendered_action_view
70
+ result.must_be_same_as html
82
71
 
83
72
  end
84
73
 
@@ -0,0 +1,66 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../minitest_helper')
2
+
3
+ describe Kilt::Formatting do
4
+
5
+ describe "getting the formatted names of things" do
6
+
7
+ [
8
+ [:horse, 'Horse', 'Horses'],
9
+ [:cat, 'Cat', 'Cats'],
10
+ [:no_namey, 'No Namey', 'No Nameys'],
11
+ [:big_green_alligator, 'Big Green Alligator', 'Big Green Alligators'],
12
+ [:apple, 'Orange', 'Oranges'],
13
+ [:im_not_in_config, 'Im Not In Config', 'Im Not In Configs'],
14
+ ].map { |x| Struct.new(:type, :singular, :plural).new(*x) }.each do |example|
15
+
16
+ describe "multiple examples" do
17
+
18
+ if Kilt.send(example.type) # ignore this test if this is not a kilt object
19
+
20
+ describe "passing a kilt object" do
21
+
22
+ it "should return the singular form of the kilt object" do
23
+ object = Kilt::Object.new example.type
24
+ Kilt::Formatting.singular_name_of(object).must_equal example.singular
25
+ end
26
+
27
+ it "should return the plural form of the kilt object" do
28
+ object = Kilt::Object.new example.type
29
+ Kilt::Formatting.plural_name_of(object).must_equal example.plural
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ describe "passing a symbol" do
37
+
38
+ it "should return the singular form of the symbol" do
39
+ Kilt::Formatting.singular_name_of(example.type).must_equal example.singular
40
+ end
41
+
42
+ it "should return the plural form of the symbol" do
43
+ Kilt::Formatting.plural_name_of(example.type).must_equal example.plural
44
+ end
45
+
46
+ end
47
+
48
+ describe "passing a string" do
49
+
50
+ it "should return the singular form of the string" do
51
+ Kilt::Formatting.singular_name_of(example.type.to_s).must_equal example.singular
52
+ end
53
+
54
+ it "should return the plural form of the string" do
55
+ Kilt::Formatting.plural_name_of(example.type.to_s).must_equal example.plural
56
+ end
57
+
58
+ end
59
+
60
+ end
61
+
62
+ end
63
+
64
+ end
65
+
66
+ end
@@ -0,0 +1,204 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../minitest_helper')
2
+
3
+ describe Kilt::Object do
4
+
5
+ describe "defining an object" do
6
+ describe "the object does not have a field type specified" do
7
+ it "should have a name field" do
8
+ name = Object.new
9
+
10
+ object = Kilt::Object.new('no_namey')
11
+ object.fill( { 'name' => name } )
12
+
13
+ object['name'].must_be_same_as name
14
+ end
15
+ end
16
+ end
17
+
18
+ describe "[]" do
19
+
20
+ let(:values) { {} }
21
+
22
+ let(:object) do
23
+ Kilt::Object.new('cat', values)
24
+ end
25
+
26
+ describe "html_safe is not defined" do
27
+ it "should return values that were passed in" do
28
+ value = Object.new
29
+ values['fruit'] = value
30
+ object['fruit'].must_equal value
31
+ end
32
+ end
33
+
34
+ describe "html_safe is defined" do
35
+ it "should return the html_safe value" do
36
+ value, html_safe_value = Object.new, Object.new
37
+ value.stubs(:html_safe).returns html_safe_value
38
+ values['vegetable'] = value
39
+ object['vegetable'].must_equal html_safe_value
40
+ end
41
+ end
42
+
43
+ describe "looking up values by symbol" do
44
+ it "should return the html_safe value" do
45
+ value = Object.new
46
+ values['mineral'] = value
47
+ object[:mineral].must_equal value
48
+ end
49
+ end
50
+
51
+ describe "the value does not exist" do
52
+ it "should return nil" do
53
+ values['animal'] = nil
54
+ object['animal'].nil?.must_equal true
55
+ end
56
+
57
+ it "should return nil, even if nil is html_safe" do
58
+ NilClass.any_instance.stubs(:html_safe).returns Object.new
59
+ values['animal'] = nil
60
+ object['animal'].nil?.must_equal true
61
+ end
62
+ end
63
+
64
+ end
65
+
66
+ describe "constructing an object" do
67
+
68
+ ['cat', 'dog'].each do |type|
69
+
70
+ describe "basic scenario" do
71
+
72
+ let(:the_name) { Object.new }
73
+ let(:size) { Object.new }
74
+
75
+ let(:object) do
76
+ Kilt::Object.new(type, { 'name' => the_name,
77
+ 'size' => size } )
78
+ end
79
+
80
+ it "should initialize the variables" do
81
+ object['name'].must_be_same_as the_name
82
+ object['size'].must_be_same_as size
83
+ end
84
+
85
+ it "should set the type" do
86
+ object.type.must_equal type
87
+ end
88
+
89
+ it "should allow symbols to be used to retrieve values" do
90
+ object[:name].must_be_same_as the_name
91
+ object[:size].must_be_same_as size
92
+ end
93
+
94
+ end
95
+
96
+ describe "using symbols as keys" do
97
+
98
+ let(:the_name) { Object.new }
99
+ let(:size) { Object.new }
100
+
101
+ let(:object) do
102
+ Kilt::Object.new(type, { :name => the_name,
103
+ :size => size } )
104
+ end
105
+
106
+ it "should initialize the variables" do
107
+ object['name'].must_be_same_as the_name
108
+ object['size'].must_be_same_as size
109
+ end
110
+
111
+ it "should allow symbols to be used to retrieve values" do
112
+ object[:name].must_be_same_as the_name
113
+ object[:size].must_be_same_as size
114
+ end
115
+
116
+ end
117
+
118
+ end
119
+
120
+ end
121
+
122
+ describe "fill" do
123
+
124
+ describe "simple situation" do
125
+
126
+ let(:object) { Kilt::Object.new('cat') }
127
+
128
+ it "should set the values on the object" do
129
+ name, size = 'the name', 'the size'
130
+ object.fill( { 'name' => name, 'size' => size } )
131
+ object['name'].must_equal name
132
+ object['size'].must_equal size
133
+ end
134
+
135
+ it "should ignore fields that are not passed in the params" do
136
+ name, size = 'the name', 'the value'
137
+ object['name'] = name
138
+ object.fill( { 'size' => size } )
139
+ object['name'].must_equal name
140
+ object['size'].must_equal size
141
+ end
142
+
143
+ it "should ignore values that are not tied to fields" do
144
+ name = 'a name'
145
+ object.fill( { 'name' => name, 'something_else' => 'testing value' } )
146
+ object['name'].must_equal name
147
+ object['something_else'].nil?.must_equal true
148
+ end
149
+
150
+ [
151
+ ['cat', 'file', 'resume', 'a resume'],
152
+ ['dog', 'image', 'headshot', 'a headshot']
153
+ ].map { |x| Struct.new(:type, :field_type, :property, :value).new(*x) }.each do |scenario|
154
+
155
+ describe "files and images" do
156
+
157
+ let(:object) { Kilt::Object.new(scenario.type) }
158
+
159
+ before do
160
+ Kilt::Upload.stubs(:send)
161
+ end
162
+
163
+ it "should save the result of the file upload" do
164
+ upload_result = Object.new
165
+ Kilt::Upload.expects(:send).with(scenario.field_type, scenario.value).returns upload_result
166
+ object.fill( { 'name' => 'x', scenario.property => scenario.value } )
167
+ object[scenario.property].must_be_same_as upload_result
168
+ end
169
+
170
+ describe "the hidden value is set to clear" do
171
+ it "should set the value to an empty string" do
172
+ upload_result = Object.new
173
+ object.fill( { 'name' => 'x', "#{scenario.property}-hidden" => 'clear' } )
174
+ object[scenario.property].must_equal ''
175
+ end
176
+ end
177
+
178
+ describe "the hidden value is set to an empty string" do
179
+ it "should NOT set the value to an empty string" do
180
+ upload_result = Object.new
181
+ object[scenario.property] = scenario.value
182
+ object.fill( { 'name' => 'x', "#{scenario.property}-hidden" => '' } )
183
+ object[scenario.property].must_equal scenario.value
184
+ end
185
+ end
186
+
187
+ describe "the hidden value is set to clear AND the value is set" do
188
+ it "should set the value to an empty string" do
189
+ upload_result = Object.new
190
+ Kilt::Upload.expects(:send).with(scenario.field_type, scenario.value).returns upload_result
191
+ object.fill( { 'name' => 'x', scenario.property => scenario.value, "#{scenario.property}-hidden" => 'clear' } )
192
+ object[scenario.property].must_be_same_as upload_result
193
+ end
194
+ end
195
+
196
+ end
197
+
198
+ end
199
+
200
+ end
201
+
202
+ end
203
+
204
+ end