rapidfire 4.0.0 → 8.0.0

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 (195) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +120 -96
  3. data/app/assets/config/manifest.js +3 -0
  4. data/app/controllers/rapidfire/application_controller.rb +6 -2
  5. data/app/controllers/rapidfire/attempts_controller.rb +2 -2
  6. data/app/controllers/rapidfire/questions_controller.rb +1 -1
  7. data/app/controllers/rapidfire/surveys_controller.rb +30 -13
  8. data/app/helpers/rapidfire/application_helper.rb +25 -0
  9. data/app/models/rapidfire/answer.rb +6 -1
  10. data/app/models/rapidfire/attempt.rb +1 -1
  11. data/app/models/rapidfire/question.rb +34 -4
  12. data/app/models/rapidfire/questions/checkbox.rb +1 -1
  13. data/app/models/rapidfire/questions/file.rb +6 -0
  14. data/app/models/rapidfire/questions/information.rb +6 -0
  15. data/app/models/rapidfire/questions/multi_file.rb +6 -0
  16. data/app/models/rapidfire/survey.rb +42 -2
  17. data/app/services/rapidfire/attempt_builder.rb +14 -1
  18. data/app/services/rapidfire/question_form.rb +5 -1
  19. data/app/services/rapidfire/survey_results.rb +38 -4
  20. data/app/views/rapidfire/answers/_checkbox.html.erb +1 -1
  21. data/app/views/rapidfire/answers/_date.html.erb +1 -1
  22. data/app/views/rapidfire/answers/_file.html.erb +5 -0
  23. data/app/views/rapidfire/answers/_information.html.erb +4 -0
  24. data/app/views/rapidfire/answers/_long.html.erb +1 -1
  25. data/app/views/rapidfire/answers/_multifile.html.erb +5 -0
  26. data/app/views/rapidfire/answers/_numeric.html.erb +1 -1
  27. data/app/views/rapidfire/answers/_radio.html.erb +1 -1
  28. data/app/views/rapidfire/answers/_select.html.erb +1 -1
  29. data/app/views/rapidfire/answers/_short.html.erb +1 -1
  30. data/app/views/rapidfire/attempts/_form.html.erb +9 -1
  31. data/app/views/rapidfire/attempts/edit.html.erb +1 -1
  32. data/app/views/rapidfire/attempts/new.html.erb +1 -1
  33. data/app/views/rapidfire/questions/_form.html.erb +1 -1
  34. data/app/views/rapidfire/surveys/_survey.html.erb +6 -0
  35. data/app/views/rapidfire/surveys/index.html.erb +7 -2
  36. data/app/views/rapidfire/surveys/results.html.erb +3 -1
  37. data/db/migrate/20190701274749_add_active_to_surveys.rb +12 -0
  38. data/lib/generators/rapidfire/active_survey_migration_generator.rb +18 -0
  39. data/lib/generators/rapidfire/templates/migrations/add_active_to_survey.rb +5 -0
  40. data/lib/rapidfire/version.rb +1 -1
  41. data/lib/tasks/change_delimiter_to_srsn.rake +1 -1
  42. data/lib/tasks/rapidfire.rake +10 -0
  43. data/spec/controllers/rapidfire/attempts_controller_spec.rb +1 -1
  44. data/spec/dummy/README.rdoc +1 -1
  45. data/spec/dummy/app/assets/config/mainfest.js +2 -0
  46. data/spec/dummy/app/models/application_record.rb +3 -0
  47. data/spec/dummy/app/models/user.rb +2 -0
  48. data/spec/dummy/app/views/layouts/application.html.erb +0 -2
  49. data/spec/dummy/config/application.rb +22 -3
  50. data/spec/dummy/config/environments/development.rb +1 -1
  51. data/spec/dummy/config/environments/test.rb +5 -0
  52. data/spec/dummy/config/storage.yml +7 -0
  53. data/spec/dummy/db/development.sqlite3 +0 -0
  54. data/spec/dummy/db/migrate/20170701191422_create_users.rb +15 -0
  55. data/spec/dummy/db/migrate/20230402174122_create_active_storage_tables.active_storage.rb +67 -0
  56. data/spec/dummy/db/schema.rb +51 -17
  57. data/spec/dummy/db/test.sqlite3 +0 -0
  58. data/spec/dummy/log/development.log +90 -200
  59. data/spec/dummy/log/test.log +12744 -14006
  60. data/spec/dummy/tmp/storage--ruby-3.3.5/81/2n/812ne4iy4c40lvvdigsg8z02b1v1 +1 -0
  61. data/spec/dummy/tmp/storage--ruby-3.3.5/85/bs/85bsmaecej0491dey4t9jpci9yw3 +1 -0
  62. data/spec/dummy/tmp/storage--ruby-3.3.5/8y/7b/8y7bhqwxh5cad8xau7nfhtukxcsc +1 -0
  63. data/spec/dummy/tmp/storage--ruby-3.3.5/93/z6/93z6nje4f921vgdwa3lkuf49xocr +1 -0
  64. data/spec/dummy/tmp/storage--ruby-3.3.5/at/qk/atqksrev4s0ic4srii57aspu4o6z +1 -0
  65. data/spec/dummy/tmp/storage--ruby-3.3.5/bi/j3/bij3puzjsfm39colnpqstpu6ggv7 +1 -0
  66. data/spec/dummy/tmp/storage--ruby-3.3.5/cx/4p/cx4pp9ugdv2xndwll28mo8jhjgig +1 -0
  67. data/spec/dummy/tmp/storage--ruby-3.3.5/gv/9c/gv9cand9rqcew9sceoirbfm9l2bl +1 -0
  68. data/spec/dummy/tmp/storage--ruby-3.3.5/m2/ce/m2cehdwpmdl0s5vgylxc1tcbxlr2 +1 -0
  69. data/spec/dummy/tmp/storage--ruby-3.3.5/md/rj/mdrjgxirkdtyfijfwdxn37dswspm +1 -0
  70. data/spec/dummy/tmp/storage--ruby-3.3.5/xv/oi/xvoijswvk9a0blrua7x5yl94a6qw +1 -0
  71. data/spec/dummy/tmp/storage--ruby-3.3.5/z6/cw/z6cw41euxe15z3ao5wkypp0y9liw +1 -0
  72. data/spec/factories/answers_factory.rb +4 -4
  73. data/spec/factories/attempts_factory.rb +2 -2
  74. data/spec/factories/questions_factory.rb +13 -7
  75. data/spec/factories/surveys_factory.rb +3 -3
  76. data/spec/factories/users_factory.rb +5 -0
  77. data/spec/features/rapidfire/answering_questions_spec.rb +66 -9
  78. data/spec/features/rapidfire/editing_answers_spec.rb +6 -6
  79. data/spec/features/rapidfire/managing_questions_spec.rb +3 -3
  80. data/spec/features/rapidfire/managing_surveys_spec.rb +18 -3
  81. data/spec/fixtures/files/one.txt +1 -0
  82. data/spec/fixtures/files/two.txt +1 -0
  83. data/spec/models/rapidfire/answer_spec.rb +2 -2
  84. data/spec/models/rapidfire/attempt_spec.rb +5 -1
  85. data/spec/models/rapidfire/question_spec.rb +3 -3
  86. data/spec/models/rapidfire/questions/checkbox_spec.rb +3 -3
  87. data/spec/models/rapidfire/questions/date_spec.rb +2 -2
  88. data/spec/models/rapidfire/questions/file_spec.rb +57 -0
  89. data/spec/models/rapidfire/questions/multi_file_spec.rb +60 -0
  90. data/spec/models/rapidfire/questions/numeric_spec.rb +2 -2
  91. data/spec/models/rapidfire/questions/select_spec.rb +3 -3
  92. data/spec/models/rapidfire/survey_spec.rb +1 -1
  93. data/spec/serializers/rapidfire/question_result_serializer_spec.rb +1 -1
  94. data/spec/services/rapidfire/attempt_builder_spec.rb +64 -16
  95. data/spec/services/rapidfire/question_form_spec.rb +3 -3
  96. data/spec/services/rapidfire/survey_results_spec.rb +1 -1
  97. data/spec/spec_helper.rb +1 -1
  98. data/spec/support/rapidfire/answer_spec_helper.rb +12 -12
  99. data/spec/support/rapidfire/question_spec_helper.rb +7 -7
  100. data/spec/tasks/change_delimiter_from_comma_to_srsn_spec.rb +8 -8
  101. metadata +106 -240
  102. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-N/-Nnl5LNk36kVPJf_3kuN5xu7Ebj5HCbnrsyxphSIsdg.cache +0 -0
  103. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-o/-ojJ77Tf5UKdeHBEDmWtQ_3tnTJqQ0nd-YsKamqADUE.cache +0 -1
  104. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2b/2bErzwvSRmQv4cAljE5MLyihOZ0NcAw3J8cE3Lt0e4Q.cache +0 -0
  105. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4C/4CJwpaeIKdXtjEAju7_wQgXuYrzr55ARwRJeVKN7CPM.cache +0 -0
  106. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4U/4UispN4bfPqEzViX3T416Fr-T-7awbayU5fSryvLFNw.cache +0 -0
  107. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4k/4kH3sikLuE3o4jE_TNDlBNrlF7XAo_qYtBA6ckHGa5I.cache +0 -0
  108. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7d/7drzegBZRzthT8NYQjAVcg1mCXgXUj5USwB8GQ1o23Y.cache +0 -1
  109. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/80/80TT8hyotZ8-XWzQe7ELHNN8U6Mp2oGKwqa6Ckoksx0.cache +0 -1
  110. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8F/8FRx5PWf5mlaMlBnq_oPScrqvzB2csCEVlQ-FbB7Jy8.cache +0 -0
  111. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8M/8MNahq2o0fNDjjgT-erC9ZV3sFYg4ifFZqlLkcifOSA.cache +0 -1
  112. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8W/8WURt7NXtVdx9vbcRVtNXo2mqrL-0LPzw609oR1ZXnk.cache +0 -0
  113. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8k/8kFdViWjxSCYCA00vzJCIk-Hl7Dv6xCJ_Ce3jZALweg.cache +0 -1
  114. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/9-/9-6v3_GF1yDfksWqHBJ96NiduUWyrW5R3k6MQzVpork.cache +0 -0
  115. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/94/94L1rKpX0k77vTIGtqElUDP4dpQXrCmvpI9CmQcZ_aM.cache +0 -1
  116. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/9s/9s2S3Z_vncpN-gwuV05kcjhELi_kX-saO8shiQRx8cU.cache +0 -0
  117. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AS/AS1POBxm-FJcvGXfKUC02RI960YWQRZP6B5bJ9Pc8qU.cache +0 -1
  118. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AS/Asy0YwmSFpm-OyM4_Lb9v5CTPAePa74fljOfWyS3SJY.cache +0 -0
  119. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AY/AYSNFEx7wRHtwbVh3cNGid6wCMdfgyk9ocorMLfRqx4.cache +0 -0
  120. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Bk/BkxzEgJOpM-iCKaxrcsZlyRZeZKYVDlUj0C-sPXVGPc.cache +0 -0
  121. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/CW/CW8uYbA8W5LQ0T8Bo2ygunrwYuaHB0kJJuXlPlGA5F8.cache +0 -1
  122. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Co/CooYsvCeOgtDx9ZKSzQADfurwS4WGsVpyNXMlWum68U.cache +0 -0
  123. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/DC/DCdg25PhcFibsQItx9ofgOr68CacLQumta_lSKJCoOg.cache +0 -1
  124. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Db/DbmLC3wtG7ztEvkzmVAubW8vf37XdD0bT3Kh73oed1A.cache +0 -0
  125. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Db/dBQCcGB2fmK2CTrjrkLGxVmGKqBC2AZAx2C6TUMa1XY.cache +0 -0
  126. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Dn/Dn7Jw00mRZVDDxhjSg9300HJb_1875nlul_DHMMinn8.cache +0 -1
  127. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/IH/IHV1NrIJaxcdliBIo7Z7i28Nqm-8xd7RplmATbQZysI.cache +0 -0
  128. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ie/IemA55SqXkoyW_cD7FDwSk834ZydXI6UJpy7QsD-H5Q.cache +0 -0
  129. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/K7/K7SHc_erMPqr16VuAuVxvKfOUmN9Xf9zCR5Mmr6jOTo.cache +0 -0
  130. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/KG/KGhjc0Py_DB3csmx7Y7NGPUOfnsPXP_KJc94bFEIZls.cache +0 -1
  131. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Lz/LzA8Mm_F0jmw6BK_4ca5scIcIGc6RjWV54G-BeQv8cA.cache +0 -0
  132. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/MP/MPTz2thdBdQPKUgb5k1oYWT6cmJYgRTEz_NEYDQt7E0.cache +0 -0
  133. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Mt/MtTjUV8qKCTEH961LJhYQWADgVragV9D9xWWiCmxyNc.cache +0 -1
  134. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/O9/O9WxLI48Zh1ES7ZCQC-cX2C7A_-Wg_c_kUOsIHodXW0.cache +0 -0
  135. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Qo/QoZwnBtkSf3joyR1_5FKACUOgfoO35xMFOfLJkJqFD8.cache +0 -1
  136. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/R6/R6G-TFFztlxL5XDMIFX62wKkfUfmib6oV93z-xCZWsU.cache +0 -1
  137. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ry/Ry0Py6y0kHcEYq6qNWzUVQaMeP_p4kGPbD3ZchhmvEA.cache +0 -1
  138. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/SD/SDy6hVbUInn62jE9aAJObZ8NmVkGE5sF7KxhzNEwjys.cache +0 -0
  139. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/SD/sdxeRQBFEvjbUw-k3jsefKcslmEkm88PryW_XDPfOWU.cache +0 -0
  140. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/SH/SHUtigN8XJz-0yTSrOMb-kFlv8iOSvIKmMU76EwSoY0.cache +0 -0
  141. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Tg/TgTcVvqf5KTGti25aDSVdPzdEFSzFCA7TIgv36nVcSw.cache +0 -0
  142. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Tj/TjvztGCZ2bx84O9DtrIqlbV9f36XZWuZRucFAwvdgJI.cache +0 -0
  143. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Tw/Twx5_JY_0JVEAdweDWUNH8zBfK8PB6OnwROdMaXHv98.cache +0 -1
  144. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/UD/UD9ueo8syy1g__X14lIaWY51JAsI5nkxjvn4iz7-B68.cache +0 -1
  145. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/VY/VYOSVFxELVZ_dWFjIfo96exB1iYypEPPaE0U-NYUk3I.cache +0 -0
  146. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Vq/VqF69IHPfaZOy6Wd3s10PIQmt2iWbU7UKgi7gGhoY6c.cache +0 -1
  147. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/W3/W3k3ezbkIWPsSAffgGGMKKSe_1CPV2jCUAXtFPSKTjE.cache +0 -0
  148. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/XY/XYnyPDtRIxqi5PSIcR0DKovMSyfgt-vquXm2oF4YcYU.cache +0 -0
  149. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Xe/Xez_IMQeyfLa4U_cntyZgtqAxc9P-spYMcKOwgwqfUk.cache +0 -1
  150. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Xp/XpKq_V1bVRTt2Dm9n2LFly2fc7rc63m5n0TkruAIT9U.cache +0 -1
  151. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/YQ/YQ07c7yZvQDkWCDNv-r_m3MczWVJMkpDlY6mItSQvDI.cache +0 -0
  152. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_D/_Du4UKNyRoKp1L8GangzMxQuHGRXv9UNLRFzUUG-8Mo.cache +0 -0
  153. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_i/_ioj978qaHpKe71YAPRTMr52bYBz1jBQH_a9jnVNxto.cache +0 -1
  154. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/a9/a9w-3USbjccL8aE_56A0EsenyNCD6btCxgmr4_s-LVk.cache +0 -0
  155. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/c6/c6TDdHnqxfaHueLdYt538jXw_7RBFpECFkp7A4pWUfs.cache +0 -1
  156. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dH/dH4Xkqb5rV9DHHmRa_ODseSEFnlwS0AXeHgoCYqkkZ8.cache +0 -0
  157. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dU/dUHj3xc9qlZfXc7VP69mfddx5l1sXwlfejSWXIdb1JQ.cache +0 -1
  158. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/de/derm8VJMOzbaRf2rY8Vz6WSHk5w-XAKJIsAIHU5Ng58.cache +0 -1
  159. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/e6/e6jkUzONoMPGAC7nyZsGla8Zm7wPlhXwijdHIYF-FTo.cache +0 -0
  160. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/fJ/fJ5wsH-IHhi_3Wg-4Yk01_O8Bw8SpcxPh-PaN6n38CQ.cache +0 -0
  161. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/g3/g3XXzOg1WKmExnfECaHxaHbjrF8feoJ60TwJJQzWlhI.cache +0 -0
  162. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/g4/g4tbfWjrt8uCm6WfFre4E1yEp4WC9rV9pFrA_9VHQys.cache +0 -0
  163. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gm/gmSFGhfFSAm1wrLyyGXOUXMn-kygBbG7Zf3unPKzEWw.cache +0 -1
  164. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gz/gz6bIRfuHgLuNBVVsocUuzLbEU4gEneTbmvzi27eoho.cache +0 -0
  165. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hM/hMgVzrZus4Z8I8AXg5NPYgizKLI5WwSbt5NKdK00slk.cache +0 -0
  166. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iw/iwQwbZENFRwrGzETXtK_2_3aqWyAENDNwJAdJu1RoBg.cache +0 -1
  167. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/kJ/kJSsmIsKQHNWdfJ2rMMpTZQ6DeAipIUyiXdftUlXr4I.cache +0 -0
  168. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ky/ky_7gNCiNp9E5HHXqszipoMZuSpcxD9ceXe46g_5VzI.cache +0 -1
  169. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lJ/lJf_GZ6JzbMPq2WIEKNQKFh5vI9T8ylMDcZQMcgj1fg.cache +0 -1
  170. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lo/lo0mbuMJiW9QksbTzvZ6N6aknuNrk1sJCprfNsMJw50.cache +0 -0
  171. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/m8/m801v81Cvh2CcUpw7286U_9CC2tO0z4XBKhfVx8OabE.cache +0 -1
  172. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/mY/mYUyrqDItAnpMyLO7mNA7gPs93yNLb7Hr66jqh-aJmk.cache +0 -1
  173. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oT/oT7WJVi5xRK0iTbo-MPPVRF3__YNxLiK-kG2oSzeHgA.cache +0 -1
  174. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pr/prpHKLWY8kH_ZR0CBQBubKTbYRVzUx-u2RzceRwSedM.cache +0 -0
  175. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/py/py8m2jF8ezxgbkf0QTl2FPU21gpWQgvz96UpLr4JCbQ.cache +0 -1
  176. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/q3/q3AuG3GbIVzhGBdYCriWe8FktR40JLxYfJyauA0-CCs.cache +0 -1
  177. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/q6/q6BYa32YJF11eGVapO4ouNl6gayPIsARgMavlzZmoi0.cache +0 -0
  178. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/q7/q7yl5Q_Rk3hQdNI2dKzooG6EkbWvfGaywsvHDtNBX3E.cache +0 -0
  179. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/rc/rcasFMX-bUWsjC8vmfqpoKL6LDbNyRqjBOBJn6KxQrM.cache +0 -1
  180. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/rh/rh0ehR00zu0AmhmksJoUmSMhi6eKb30JpiSLU1Y7vGY.cache +0 -0
  181. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/t6/t6ve2uEx0ZpKYVPLJkiSm3_3nVj8hVs0ouPs-j1Y-Lw.cache +0 -0
  182. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tF/tFs-J47Vhauit7rJvH6_RG3NydHacSvI1Wn_BPK8OBs.cache +0 -1
  183. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/uU/uUfexZe40_0TvILVKPsXUS5gjsc4iul3OZCrWoXS0Qo.cache +0 -1
  184. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vF/vFj_rUSzkEPWTAvaVnIUzkZIbfolIXH2bitACRZYWAU.cache +0 -1
  185. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vk/vk-e_ORxd49RmmTia4r2ajyVw0p-xcUuz8uz8Nx_LUw.cache +0 -1
  186. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wa/wab9PO75nglTE-rq2pVPg22CRkZW_yTq_WcZ6BEp8T0.cache +0 -0
  187. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wd/wdHNDzQjfQYx2VQbObEoz4iNxGhcuum4uypNBmnuNpA.cache +0 -1
  188. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wu/wuO0z3wuhphrqHOHqZdrZd6lFv2u0_Gq7BkDoc_8cEw.cache +0 -1
  189. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/x7/x7KkTV3ibfIEysLB_ug5bfmnn2VLV_BldukPR3EoPBk.cache +0 -0
  190. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xg/xge95XbE6Me8MVp8Pnz9FbKOZhvzndxHzh-uOjZV5_s.cache +0 -0
  191. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xz/Xz-wkd5XTDRNs5mNRhBpx4RSe0LN9ajplnuDcli51jE.cache +0 -1
  192. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xz/xzFhuo3m7qD5I9Xc85aP9j6kR-iAOB0najl9uu7hdMc.cache +0 -1
  193. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/yn/ynGH6ruy4vPfFCwXOH8rgd3f-UWmo05h37jjH0cii8E.cache +0 -1
  194. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/yw/yw6SDVVxzUeXqN9VX1eCGWTN809mt05p0JnedEBCZ7w.cache +0 -0
  195. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zg/zg53gL5TWyca4nbWc_d4pFhJ7huiu6zm1BTDcALsP8c.cache +0 -1
@@ -1,9 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
+ def fixture_file_upload(path, mime_type)
4
+ Rack::Test::UploadedFile.new(Pathname.new(file_fixture_path).join(path), mime_type, false)
5
+ end
6
+
3
7
  describe Rapidfire::AttemptBuilder do
4
- let(:survey) { FactoryGirl.create(:survey) }
5
- let(:question1) { FactoryGirl.create(:q_short, survey: survey) }
6
- let(:question2) { FactoryGirl.create(:q_long, survey: survey,
8
+ let(:survey) { FactoryBot.create(:survey) }
9
+ let(:question1) { FactoryBot.create(:q_short, survey: survey) }
10
+ let(:question2) { FactoryBot.create(:q_long, survey: survey,
7
11
  validation_rules: { presence: "1" }) }
8
12
 
9
13
  describe "Creation" do
@@ -28,11 +32,6 @@ describe Rapidfire::AttemptBuilder do
28
32
  end
29
33
  let(:save_answers) { builder.save }
30
34
 
31
- before do
32
- [question1, question2]
33
- save_answers
34
- end
35
-
36
35
  context "when all the answers are valid" do
37
36
  let(:answer_params) do
38
37
  {
@@ -46,6 +45,7 @@ describe Rapidfire::AttemptBuilder do
46
45
  end
47
46
 
48
47
  it "successfully saves answers" do
48
+ save_answers
49
49
  builder.answers.each do |answer|
50
50
  expect(answer).to be_persisted
51
51
  expect(question_ids).to include(answer.question_id)
@@ -66,21 +66,69 @@ describe Rapidfire::AttemptBuilder do
66
66
  end
67
67
 
68
68
  it "fails to save those answers" do
69
+ save_answers
69
70
  expect(Rapidfire::Answer.count).to eq(0)
70
71
  end
71
72
 
72
- context "when requested to save without validations" do
73
- let(:save_answers) { builder.save(:validate => false) }
73
+ if Rails::VERSION::MAJOR < 5
74
+ context "when requested to save without validations" do
75
+ let(:save_answers) { builder.save(:validate => false) }
76
+
77
+ it "returns true" do
78
+ expect(save_answers).to be_truthy
79
+ end
80
+
81
+ it "saves all the answers" do
82
+ save_answers
83
+ builder.answers.each do |answer|
84
+ expect(answer).to be_persisted
85
+ expect(question_ids).to include(answer.question_id)
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+
92
+ if "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}" >= "5.2"
93
+ context "with a single file upload question" do
94
+ let(:question3) { FactoryBot.create(:q_file, survey: survey) }
74
95
 
75
- it "returns true" do
96
+ let(:answer_params) do
97
+ {
98
+ question1.id.to_s => { :answer_text => "short answer" },
99
+ question2.id.to_s => { :answer_text => "long answer" },
100
+ question3.id.to_s => { :file => fixture_file_upload("one.txt", "text/plain") }
101
+ }
102
+ end
103
+
104
+ it "saves the file successfully" do
76
105
  expect(save_answers).to be_truthy
106
+
107
+ answer = Rapidfire::Answer.last
108
+ expect(answer).to be_persisted
109
+ expect(answer.file.download).to eq("one\n")
77
110
  end
111
+ end
78
112
 
79
- it "saves all the answers" do
80
- builder.answers.each do |answer|
81
- expect(answer).to be_persisted
82
- expect(question_ids).to include(answer.question_id)
83
- end
113
+ context "with multiple files upload question" do
114
+ let(:question3) { FactoryBot.create(:q_multifile, survey: survey) }
115
+
116
+ let(:answer_params) do
117
+ {
118
+ question1.id.to_s => { :answer_text => "short answer" },
119
+ question2.id.to_s => { :answer_text => "long answer" },
120
+ question3.id.to_s => { :files => [fixture_file_upload("one.txt", "text/plain"),
121
+ fixture_file_upload("two.txt", "text/plain")]}
122
+ }
123
+ end
124
+
125
+ it "saves the file successfully" do
126
+ expect(save_answers).to be_truthy
127
+
128
+ answer = Rapidfire::Answer.last
129
+ expect(answer).to be_persisted
130
+ expect(answer.files[0].download).to eq("one\n")
131
+ expect(answer.files[1].download).to eq("two\n")
84
132
  end
85
133
  end
86
134
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Rapidfire::QuestionForm do
4
- let(:survey) { FactoryGirl.create(:survey) }
4
+ let(:survey) { FactoryBot.create(:survey) }
5
5
 
6
6
  describe "Creation" do
7
7
  let(:proxy) { described_class.new(survey: survey) }
@@ -19,7 +19,7 @@ describe Rapidfire::QuestionForm do
19
19
  end
20
20
 
21
21
  context "when a question is passed" do
22
- let(:question) { FactoryGirl.create(:q_checkbox, survey: survey) }
22
+ let(:question) { FactoryBot.create(:q_checkbox, survey: survey) }
23
23
  let(:proxy) { described_class.new(survey: survey, question: question) }
24
24
 
25
25
  it "persists question params" do
@@ -75,7 +75,7 @@ describe Rapidfire::QuestionForm do
75
75
  end
76
76
 
77
77
  context "updating a question" do
78
- let(:question) { FactoryGirl.create(:q_checkbox, survey: survey) }
78
+ let(:question) { FactoryBot.create(:q_checkbox, survey: survey) }
79
79
  let(:proxy) do
80
80
  proxy_params = params.merge(survey: survey, question: question)
81
81
  described_class.new(proxy_params)
@@ -4,7 +4,7 @@ describe Rapidfire::SurveyResults do
4
4
  include Rapidfire::QuestionSpecHelper
5
5
  include Rapidfire::AnswerSpecHelper
6
6
 
7
- let(:survey) { FactoryGirl.create(:survey) }
7
+ let(:survey) { FactoryBot.create(:survey) }
8
8
 
9
9
  describe '#extract' do
10
10
  before do
data/spec/spec_helper.rb CHANGED
@@ -4,7 +4,7 @@ require File.expand_path("../dummy/config/environment", __FILE__)
4
4
  require 'rspec/rails'
5
5
 
6
6
  require 'capybara/rails'
7
- require 'factory_girl_rails'
7
+ require 'factory_bot_rails'
8
8
  require 'database_cleaner'
9
9
  require 'shoulda'
10
10
 
@@ -1,22 +1,22 @@
1
1
  module Rapidfire
2
2
  module AnswerSpecHelper
3
3
  def create_answers
4
- FactoryGirl.create(:answer, :question => @question_checkbox, :answer_text => 'hindi')
5
- FactoryGirl.create(:answer, :question => @question_checkbox, :answer_text => "hindi\r\ntelugu")
6
- FactoryGirl.create(:answer, :question => @question_checkbox, :answer_text => "hindi\r\nkannada")
4
+ FactoryBot.create(:answer, :question => @question_checkbox, :answer_text => 'hindi')
5
+ FactoryBot.create(:answer, :question => @question_checkbox, :answer_text => "hindi\r\ntelugu")
6
+ FactoryBot.create(:answer, :question => @question_checkbox, :answer_text => "hindi\r\nkannada")
7
7
 
8
- FactoryGirl.create(:answer, :question => @question_select, :answer_text => 'mac')
9
- FactoryGirl.create(:answer, :question => @question_select, :answer_text => 'mac')
10
- FactoryGirl.create(:answer, :question => @question_select, :answer_text => 'windows')
8
+ FactoryBot.create(:answer, :question => @question_select, :answer_text => 'mac')
9
+ FactoryBot.create(:answer, :question => @question_select, :answer_text => 'mac')
10
+ FactoryBot.create(:answer, :question => @question_select, :answer_text => 'windows')
11
11
 
12
- FactoryGirl.create(:answer, :question => @question_radio, :answer_text => 'male')
13
- FactoryGirl.create(:answer, :question => @question_radio, :answer_text => 'female')
12
+ FactoryBot.create(:answer, :question => @question_radio, :answer_text => 'male')
13
+ FactoryBot.create(:answer, :question => @question_radio, :answer_text => 'female')
14
14
 
15
15
  3.times do
16
- FactoryGirl.create(:answer, :question => @question_date, :answer_text => Date.today.to_s)
17
- FactoryGirl.create(:answer, :question => @question_long, :answer_text => 'my bio goes on and on!')
18
- FactoryGirl.create(:answer, :question => @question_numeric, :answer_text => 999)
19
- FactoryGirl.create(:answer, :question => @question_short, :answer_text => 'this is cool')
16
+ FactoryBot.create(:answer, :question => @question_date, :answer_text => Date.today.to_s)
17
+ FactoryBot.create(:answer, :question => @question_long, :answer_text => 'my bio goes on and on!')
18
+ FactoryBot.create(:answer, :question => @question_numeric, :answer_text => 999)
19
+ FactoryBot.create(:answer, :question => @question_short, :answer_text => 'this is cool')
20
20
  end
21
21
  end
22
22
  end
@@ -1,13 +1,13 @@
1
1
  module Rapidfire
2
2
  module QuestionSpecHelper
3
3
  def create_questions(survey)
4
- @question_checkbox = FactoryGirl.create(:q_checkbox, :survey => survey)
5
- @question_date = FactoryGirl.create(:q_date, :survey => survey)
6
- @question_long = FactoryGirl.create(:q_long, :survey => survey)
7
- @question_numeric = FactoryGirl.create(:q_numeric, :survey => survey)
8
- @question_radio = FactoryGirl.create(:q_radio, :survey => survey)
9
- @question_select = FactoryGirl.create(:q_select, :survey => survey)
10
- @question_short = FactoryGirl.create(:q_short, :survey => survey)
4
+ @question_checkbox = FactoryBot.create(:q_checkbox, :survey => survey)
5
+ @question_date = FactoryBot.create(:q_date, :survey => survey)
6
+ @question_long = FactoryBot.create(:q_long, :survey => survey)
7
+ @question_numeric = FactoryBot.create(:q_numeric, :survey => survey)
8
+ @question_radio = FactoryBot.create(:q_radio, :survey => survey)
9
+ @question_select = FactoryBot.create(:q_select, :survey => survey)
10
+ @question_short = FactoryBot.create(:q_short, :survey => survey)
11
11
  end
12
12
  end
13
13
  end
@@ -9,18 +9,18 @@ describe 'rapidfire:change_delimiter_from_comma_to_srsn' do
9
9
  end
10
10
 
11
11
  it 'converts select,radio and checkbox answer options delimiter from , to \r\n' do
12
- survey = FactoryGirl.create(:survey)
13
- q_checkbox = FactoryGirl.create(:q_checkbox, survey: survey,
12
+ survey = FactoryBot.create(:survey)
13
+ q_checkbox = FactoryBot.create(:q_checkbox, survey: survey,
14
14
  answer_options: 'one,two,three')
15
- q_radio = FactoryGirl.create(:q_radio, survey: survey,
15
+ q_radio = FactoryBot.create(:q_radio, survey: survey,
16
16
  answer_options: 'hello,world')
17
- q_select = FactoryGirl.create(:q_select, survey: survey,
17
+ q_select = FactoryBot.create(:q_select, survey: survey,
18
18
  answer_options: 'new,old,historic,')
19
19
 
20
- q_date = FactoryGirl.create(:q_date, survey: survey)
21
- q_long = FactoryGirl.create(:q_long, survey: survey)
22
- q_numeric = FactoryGirl.create(:q_numeric, survey: survey)
23
- q_short = FactoryGirl.create(:q_short, survey: survey)
20
+ q_date = FactoryBot.create(:q_date, survey: survey)
21
+ q_long = FactoryBot.create(:q_long, survey: survey)
22
+ q_numeric = FactoryBot.create(:q_numeric, survey: survey)
23
+ q_short = FactoryBot.create(:q_short, survey: survey)
24
24
 
25
25
  Rake::Task['rapidfire:change_delimiter_from_comma_to_srsn'].invoke
26
26