cypress-on-rails 1.17.0 → 1.18.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 (317) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +14 -14
  3. data/README.md +178 -22
  4. data/docs/authentication.md +30 -0
  5. data/docs/factory_bot_associations.md +14 -0
  6. data/lib/cypress_on_rails/configuration.rb +5 -0
  7. data/lib/cypress_on_rails/railtie.rb +10 -2
  8. data/lib/cypress_on_rails/vcr/insert_eject_middleware.rb +75 -0
  9. data/lib/cypress_on_rails/vcr/middleware_helpers.rb +51 -0
  10. data/lib/cypress_on_rails/vcr/use_cassette_middleware.rb +56 -0
  11. data/lib/cypress_on_rails/version.rb +1 -1
  12. data/lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb +8 -0
  13. data/lib/generators/cypress_on_rails/templates/spec/cypress/support/commands.js +22 -0
  14. data/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js +1 -0
  15. data/lib/generators/cypress_on_rails/templates/spec/e2e/e2e_helper.rb.erb +0 -5
  16. data/spec/cypress_on_rails/configuration_spec.rb +4 -1
  17. data/spec/cypress_on_rails/vcr/insert_eject_middleware_spec.rb +177 -0
  18. data/spec/cypress_on_rails/vcr/use_cassette_middleware_spec.rb +68 -0
  19. data/specs_e2e/rails_6_1/.gitattributes +10 -0
  20. data/specs_e2e/rails_6_1/Gemfile +20 -0
  21. data/specs_e2e/{rails_5_2 → rails_6_1}/Rakefile +1 -1
  22. data/specs_e2e/rails_6_1/app/assets/stylesheets/application.css +15 -0
  23. data/specs_e2e/rails_6_1/app/jobs/application_job.rb +7 -0
  24. data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/layouts/application.html.erb +1 -1
  25. data/specs_e2e/rails_6_1/bin/bundle +114 -0
  26. data/specs_e2e/rails_6_1/bin/rails +5 -0
  27. data/specs_e2e/rails_6_1/bin/rake +5 -0
  28. data/specs_e2e/{rails_5_2 → rails_6_1}/bin/setup +15 -4
  29. data/specs_e2e/rails_6_1/bin/spring +14 -0
  30. data/specs_e2e/rails_6_1/bin/yarn +17 -0
  31. data/specs_e2e/rails_6_1/config/application.rb +34 -0
  32. data/specs_e2e/rails_6_1/config/boot.rb +4 -0
  33. data/specs_e2e/rails_6_1/config/cable.yml +10 -0
  34. data/specs_e2e/rails_6_1/config/credentials.yml.enc +1 -0
  35. data/specs_e2e/{rails_5_2 → rails_6_1}/config/database.yml +7 -0
  36. data/specs_e2e/{rails_5_2 → rails_6_1}/config/environment.rb +1 -1
  37. data/specs_e2e/{rails_5_2 → rails_6_1}/config/environments/development.rb +22 -5
  38. data/specs_e2e/rails_6_1/config/environments/production.rb +120 -0
  39. data/specs_e2e/{rails_5_2 → rails_6_1}/config/environments/test.rb +24 -7
  40. data/specs_e2e/rails_6_1/config/initializers/backtrace_silencers.rb +8 -0
  41. data/specs_e2e/{rails_5_2 → rails_6_1}/config/initializers/content_security_policy.rb +5 -0
  42. data/specs_e2e/{rails_4_2 → rails_6_1}/config/initializers/filter_parameter_logging.rb +3 -1
  43. data/specs_e2e/rails_6_1/config/initializers/permissions_policy.rb +11 -0
  44. data/specs_e2e/{rails_3_2 → rails_6_1}/config/initializers/wrap_parameters.rb +5 -1
  45. data/specs_e2e/{rails_5_2 → rails_6_1}/config/locales/en.yml +1 -1
  46. data/specs_e2e/rails_6_1/config/master.key +1 -0
  47. data/specs_e2e/rails_6_1/config/puma.rb +43 -0
  48. data/specs_e2e/rails_6_1/config/storage.yml +34 -0
  49. data/specs_e2e/{rails_5_2 → rails_6_1}/config.ru +2 -1
  50. data/specs_e2e/{rails_5_2 → rails_6_1}/db/migrate/20180621085832_create_posts.rb +1 -1
  51. data/specs_e2e/rails_6_1/package.json +8 -0
  52. data/specs_e2e/rails_6_1/playwright-report/index.html +71 -0
  53. data/specs_e2e/rails_6_1/public/robots.txt +1 -0
  54. data/specs_e2e/rails_6_1/test-results/.last-run.json +4 -0
  55. data/specs_e2e/{rails_4_2 → rails_6_1}/test.sh +22 -15
  56. data/specs_e2e/rails_7_2/.gitattributes +9 -0
  57. data/specs_e2e/rails_7_2/.gitignore +16 -0
  58. data/specs_e2e/rails_7_2/.rubocop.yml +8 -0
  59. data/specs_e2e/rails_7_2/Gemfile +11 -0
  60. data/specs_e2e/{rails_4_2 → rails_7_2}/Rakefile +1 -1
  61. data/specs_e2e/rails_7_2/app/assets/stylesheets/application.css +15 -0
  62. data/specs_e2e/rails_7_2/app/controllers/application_controller.rb +4 -0
  63. data/specs_e2e/rails_7_2/app/controllers/posts_controller.rb +58 -0
  64. data/specs_e2e/rails_7_2/app/helpers/posts_helper.rb +2 -0
  65. data/specs_e2e/rails_7_2/app/jobs/application_job.rb +7 -0
  66. data/specs_e2e/rails_7_2/app/models/application_record.rb +3 -0
  67. data/specs_e2e/rails_7_2/app/models/post.rb +2 -0
  68. data/specs_e2e/rails_7_2/app/views/layouts/application.html.erb +22 -0
  69. data/specs_e2e/rails_7_2/app/views/posts/_form.html.erb +32 -0
  70. data/specs_e2e/rails_7_2/app/views/posts/edit.html.erb +6 -0
  71. data/specs_e2e/rails_7_2/app/views/posts/index.html.erb +31 -0
  72. data/specs_e2e/rails_7_2/app/views/posts/new.html.erb +5 -0
  73. data/specs_e2e/rails_7_2/app/views/posts/show.html.erb +19 -0
  74. data/specs_e2e/rails_7_2/bin/brakeman +7 -0
  75. data/specs_e2e/rails_7_2/bin/bundle +109 -0
  76. data/specs_e2e/rails_7_2/bin/importmap +4 -0
  77. data/specs_e2e/rails_7_2/bin/rails +4 -0
  78. data/specs_e2e/rails_7_2/bin/rake +4 -0
  79. data/specs_e2e/rails_7_2/bin/setup +37 -0
  80. data/specs_e2e/rails_7_2/config/application.rb +37 -0
  81. data/specs_e2e/rails_7_2/config/boot.rb +4 -0
  82. data/specs_e2e/rails_7_2/config/cable.yml +10 -0
  83. data/specs_e2e/rails_7_2/config/credentials.yml.enc +1 -0
  84. data/specs_e2e/rails_7_2/config/database.yml +32 -0
  85. data/specs_e2e/{rails_4_2 → rails_7_2}/config/environment.rb +1 -1
  86. data/specs_e2e/rails_7_2/config/environments/development.rb +54 -0
  87. data/specs_e2e/rails_7_2/config/environments/production.rb +105 -0
  88. data/specs_e2e/rails_7_2/config/environments/test.rb +45 -0
  89. data/specs_e2e/rails_7_2/config/importmap.rb +7 -0
  90. data/specs_e2e/rails_7_2/config/initializers/content_security_policy.rb +25 -0
  91. data/specs_e2e/rails_7_2/config/initializers/filter_parameter_logging.rb +8 -0
  92. data/specs_e2e/{rails_5_2 → rails_7_2}/config/initializers/inflections.rb +4 -4
  93. data/specs_e2e/rails_7_2/config/initializers/permissions_policy.rb +13 -0
  94. data/specs_e2e/rails_7_2/config/locales/en.yml +31 -0
  95. data/specs_e2e/rails_7_2/config/master.key +1 -0
  96. data/specs_e2e/rails_7_2/config/puma.rb +34 -0
  97. data/specs_e2e/rails_7_2/config/routes.rb +5 -0
  98. data/specs_e2e/rails_7_2/config/storage.yml +34 -0
  99. data/specs_e2e/{rails_4_2 → rails_7_2}/config.ru +3 -1
  100. data/specs_e2e/rails_7_2/db/migrate/20180621085832_create_posts.rb +11 -0
  101. data/specs_e2e/rails_7_2/db/seeds.rb +9 -0
  102. data/specs_e2e/rails_7_2/db/test.sqlite3-shm +0 -0
  103. data/specs_e2e/rails_7_2/db/test.sqlite3-wal +0 -0
  104. data/specs_e2e/rails_7_2/package.json +8 -0
  105. data/specs_e2e/rails_7_2/playwright-report/index.html +71 -0
  106. data/specs_e2e/{rails_4_2 → rails_7_2}/public/404.html +6 -6
  107. data/specs_e2e/rails_7_2/public/406-unsupported-browser.html +66 -0
  108. data/specs_e2e/{rails_4_2 → rails_7_2}/public/422.html +6 -6
  109. data/specs_e2e/{rails_4_2 → rails_7_2}/public/500.html +6 -6
  110. data/specs_e2e/rails_7_2/public/icon.png +0 -0
  111. data/specs_e2e/rails_7_2/public/icon.svg +3 -0
  112. data/specs_e2e/rails_7_2/public/robots.txt +1 -0
  113. data/specs_e2e/rails_7_2/storage/test.sqlite3 +0 -0
  114. data/specs_e2e/rails_7_2/test/controllers/posts_controller_test.rb +48 -0
  115. data/specs_e2e/rails_7_2/test/cypress_fixtures/posts.yml +11 -0
  116. data/specs_e2e/rails_7_2/test/fixtures/posts.yml +11 -0
  117. data/specs_e2e/rails_7_2/test/models/post_test.rb +7 -0
  118. data/specs_e2e/rails_7_2/test-results/.last-run.json +4 -0
  119. data/specs_e2e/rails_7_2/test.sh +57 -0
  120. data/specs_e2e/rails_8/.gitattributes +9 -0
  121. data/specs_e2e/rails_8/.gitignore +16 -0
  122. data/specs_e2e/rails_8/.rubocop.yml +8 -0
  123. data/specs_e2e/rails_8/Gemfile +20 -0
  124. data/specs_e2e/{rails_3_2 → rails_8}/Rakefile +2 -3
  125. data/specs_e2e/rails_8/app/assets/stylesheets/application.css +10 -0
  126. data/specs_e2e/rails_8/app/controllers/application_controller.rb +4 -0
  127. data/specs_e2e/rails_8/app/controllers/posts_controller.rb +58 -0
  128. data/specs_e2e/rails_8/app/helpers/posts_helper.rb +2 -0
  129. data/specs_e2e/rails_8/app/jobs/application_job.rb +7 -0
  130. data/specs_e2e/rails_8/app/models/application_record.rb +3 -0
  131. data/specs_e2e/rails_8/app/models/post.rb +2 -0
  132. data/specs_e2e/rails_8/app/views/layouts/application.html.erb +27 -0
  133. data/specs_e2e/rails_8/app/views/posts/_form.html.erb +32 -0
  134. data/specs_e2e/rails_8/app/views/posts/edit.html.erb +6 -0
  135. data/specs_e2e/rails_8/app/views/posts/index.html.erb +31 -0
  136. data/specs_e2e/rails_8/app/views/posts/new.html.erb +5 -0
  137. data/specs_e2e/rails_8/app/views/posts/show.html.erb +19 -0
  138. data/specs_e2e/rails_8/bin/brakeman +7 -0
  139. data/specs_e2e/rails_8/bin/bundle +109 -0
  140. data/specs_e2e/rails_8/bin/dev +2 -0
  141. data/specs_e2e/rails_8/bin/importmap +4 -0
  142. data/specs_e2e/rails_8/bin/rails +4 -0
  143. data/specs_e2e/rails_8/bin/rake +4 -0
  144. data/specs_e2e/rails_8/bin/setup +34 -0
  145. data/specs_e2e/rails_8/bin/thrust +5 -0
  146. data/specs_e2e/rails_8/config/application.rb +27 -0
  147. data/specs_e2e/rails_8/config/boot.rb +4 -0
  148. data/specs_e2e/rails_8/config/cable.yml +17 -0
  149. data/specs_e2e/rails_8/config/cache.yml +16 -0
  150. data/specs_e2e/rails_8/config/credentials.yml.enc +1 -0
  151. data/specs_e2e/rails_8/config/database.yml +41 -0
  152. data/specs_e2e/rails_8/config/deploy.yml +116 -0
  153. data/specs_e2e/rails_8/config/environment.rb +5 -0
  154. data/specs_e2e/rails_8/config/environments/development.rb +57 -0
  155. data/specs_e2e/rails_8/config/environments/production.rb +90 -0
  156. data/specs_e2e/rails_8/config/environments/test.rb +45 -0
  157. data/specs_e2e/rails_8/config/importmap.rb +7 -0
  158. data/specs_e2e/rails_8/config/initializers/content_security_policy.rb +25 -0
  159. data/specs_e2e/rails_8/config/initializers/filter_parameter_logging.rb +8 -0
  160. data/specs_e2e/rails_8/config/initializers/inflections.rb +16 -0
  161. data/specs_e2e/rails_8/config/locales/en.yml +31 -0
  162. data/specs_e2e/rails_8/config/master.key +1 -0
  163. data/specs_e2e/rails_8/config/puma.rb +41 -0
  164. data/specs_e2e/rails_8/config/queue.yml +18 -0
  165. data/specs_e2e/rails_8/config/recurring.yml +10 -0
  166. data/specs_e2e/rails_8/config/routes.rb +5 -0
  167. data/specs_e2e/rails_8/config/storage.yml +34 -0
  168. data/specs_e2e/rails_8/config.ru +6 -0
  169. data/specs_e2e/rails_8/db/cable_schema.rb +11 -0
  170. data/specs_e2e/rails_8/db/cache_schema.rb +14 -0
  171. data/specs_e2e/rails_8/db/migrate/20180621085832_create_posts.rb +11 -0
  172. data/specs_e2e/rails_8/db/queue_schema.rb +129 -0
  173. data/specs_e2e/rails_8/db/seeds.rb +9 -0
  174. data/specs_e2e/rails_8/package.json +8 -0
  175. data/specs_e2e/rails_8/playwright-report/index.html +71 -0
  176. data/specs_e2e/rails_8/public/400.html +114 -0
  177. data/specs_e2e/rails_8/public/404.html +114 -0
  178. data/specs_e2e/rails_8/public/406-unsupported-browser.html +114 -0
  179. data/specs_e2e/rails_8/public/422.html +114 -0
  180. data/specs_e2e/rails_8/public/500.html +114 -0
  181. data/specs_e2e/rails_8/public/icon.png +0 -0
  182. data/specs_e2e/rails_8/public/icon.svg +3 -0
  183. data/specs_e2e/rails_8/public/robots.txt +1 -0
  184. data/specs_e2e/rails_8/storage/test.sqlite3 +0 -0
  185. data/specs_e2e/rails_8/storage/test.sqlite3-shm +0 -0
  186. data/specs_e2e/rails_8/storage/test.sqlite3-wal +0 -0
  187. data/specs_e2e/rails_8/test/application_system_test_case.rb +5 -0
  188. data/specs_e2e/rails_8/test/controllers/posts_controller_test.rb +48 -0
  189. data/specs_e2e/rails_8/test/cypress_fixtures/posts.yml +11 -0
  190. data/specs_e2e/rails_8/test/fixtures/posts.yml +11 -0
  191. data/specs_e2e/rails_8/test/models/post_test.rb +7 -0
  192. data/specs_e2e/rails_8/test/test_helper.rb +15 -0
  193. data/specs_e2e/rails_8/test-results/.last-run.json +4 -0
  194. data/specs_e2e/{rails_5_2 → rails_8}/test.sh +1 -1
  195. metadata +217 -150
  196. data/lib/cypress_on_rails/vcr_middleware.rb +0 -73
  197. data/spec/cypress_on_rails/vcr_middleware_spec.rb +0 -119
  198. data/specs_e2e/rails_3_2/.gitignore +0 -9
  199. data/specs_e2e/rails_3_2/.ruby_version +0 -1
  200. data/specs_e2e/rails_3_2/Gemfile +0 -7
  201. data/specs_e2e/rails_3_2/README.rdoc +0 -261
  202. data/specs_e2e/rails_3_2/app/assets/stylesheets/application.css +0 -13
  203. data/specs_e2e/rails_3_2/app/controllers/application_controller.rb +0 -3
  204. data/specs_e2e/rails_3_2/app/controllers/welcome_controller.rb +0 -4
  205. data/specs_e2e/rails_3_2/app/helpers/application_helper.rb +0 -2
  206. data/specs_e2e/rails_3_2/app/models/post.rb +0 -21
  207. data/specs_e2e/rails_3_2/app/views/layouts/application.html.erb +0 -13
  208. data/specs_e2e/rails_3_2/app/views/welcome/index.html.erb +0 -24
  209. data/specs_e2e/rails_3_2/bin/rails +0 -6
  210. data/specs_e2e/rails_3_2/config/application.rb +0 -68
  211. data/specs_e2e/rails_3_2/config/boot.rb +0 -6
  212. data/specs_e2e/rails_3_2/config/environment.rb +0 -5
  213. data/specs_e2e/rails_3_2/config/environments/development.rb +0 -31
  214. data/specs_e2e/rails_3_2/config/environments/production.rb +0 -64
  215. data/specs_e2e/rails_3_2/config/environments/test.rb +0 -35
  216. data/specs_e2e/rails_3_2/config/initializers/backtrace_silencers.rb +0 -7
  217. data/specs_e2e/rails_3_2/config/initializers/inflections.rb +0 -15
  218. data/specs_e2e/rails_3_2/config/initializers/mime_types.rb +0 -5
  219. data/specs_e2e/rails_3_2/config/initializers/secret_token.rb +0 -7
  220. data/specs_e2e/rails_3_2/config/initializers/session_store.rb +0 -8
  221. data/specs_e2e/rails_3_2/config/locales/en.yml +0 -5
  222. data/specs_e2e/rails_3_2/config/routes.rb +0 -60
  223. data/specs_e2e/rails_3_2/config.ru +0 -4
  224. data/specs_e2e/rails_3_2/public/404.html +0 -26
  225. data/specs_e2e/rails_3_2/public/422.html +0 -26
  226. data/specs_e2e/rails_3_2/public/500.html +0 -25
  227. data/specs_e2e/rails_3_2/public/robots.txt +0 -5
  228. data/specs_e2e/rails_3_2/test.sh +0 -50
  229. data/specs_e2e/rails_4_2/.gitignore +0 -12
  230. data/specs_e2e/rails_4_2/Gemfile +0 -11
  231. data/specs_e2e/rails_4_2/README.rdoc +0 -28
  232. data/specs_e2e/rails_4_2/app/assets/javascripts/using_vcr.js +0 -2
  233. data/specs_e2e/rails_4_2/app/assets/stylesheets/using_vcr.css +0 -4
  234. data/specs_e2e/rails_4_2/app/controllers/application_controller.rb +0 -5
  235. data/specs_e2e/rails_4_2/app/controllers/using_vcr_controller.rb +0 -10
  236. data/specs_e2e/rails_4_2/app/controllers/welcome_controller.rb +0 -4
  237. data/specs_e2e/rails_4_2/app/models/post.rb +0 -23
  238. data/specs_e2e/rails_4_2/app/views/layouts/application.html.erb +0 -12
  239. data/specs_e2e/rails_4_2/app/views/using_vcr/index.html.erb +0 -6
  240. data/specs_e2e/rails_4_2/app/views/using_vcr/record_cats.html.erb +0 -7
  241. data/specs_e2e/rails_4_2/app/views/welcome/index.html.erb +0 -24
  242. data/specs_e2e/rails_4_2/bin/bundle +0 -3
  243. data/specs_e2e/rails_4_2/bin/rails +0 -4
  244. data/specs_e2e/rails_4_2/bin/rake +0 -4
  245. data/specs_e2e/rails_4_2/bin/setup +0 -29
  246. data/specs_e2e/rails_4_2/config/application.rb +0 -32
  247. data/specs_e2e/rails_4_2/config/boot.rb +0 -3
  248. data/specs_e2e/rails_4_2/config/environments/development.rb +0 -25
  249. data/specs_e2e/rails_4_2/config/environments/production.rb +0 -64
  250. data/specs_e2e/rails_4_2/config/environments/test.rb +0 -42
  251. data/specs_e2e/rails_4_2/config/initializers/backtrace_silencers.rb +0 -7
  252. data/specs_e2e/rails_4_2/config/initializers/cookies_serializer.rb +0 -3
  253. data/specs_e2e/rails_4_2/config/initializers/session_store.rb +0 -3
  254. data/specs_e2e/rails_4_2/config/initializers/to_time_preserves_timezone.rb +0 -10
  255. data/specs_e2e/rails_4_2/config/initializers/wrap_parameters.rb +0 -9
  256. data/specs_e2e/rails_4_2/config/locales/en.yml +0 -23
  257. data/specs_e2e/rails_4_2/config/routes.rb +0 -61
  258. data/specs_e2e/rails_4_2/config/secrets.yml +0 -22
  259. data/specs_e2e/rails_4_2/package.json +0 -12
  260. data/specs_e2e/rails_4_2/playwright-report/index.html +0 -62
  261. data/specs_e2e/rails_4_2/public/favicon.ico +0 -0
  262. data/specs_e2e/rails_4_2/public/robots.txt +0 -5
  263. data/specs_e2e/rails_4_2/spec/fixtures/vcr_cassettes/cats.yml +0 -63
  264. data/specs_e2e/rails_5_2/Gemfile +0 -15
  265. data/specs_e2e/rails_5_2/app/assets/javascripts/posts.js +0 -2
  266. data/specs_e2e/rails_5_2/app/assets/stylesheets/posts.css +0 -4
  267. data/specs_e2e/rails_5_2/app/assets/stylesheets/scaffold.css +0 -80
  268. data/specs_e2e/rails_5_2/app/jobs/application_job.rb +0 -2
  269. data/specs_e2e/rails_5_2/app/views/welcome/index.html.erb +0 -5
  270. data/specs_e2e/rails_5_2/bin/bundle +0 -3
  271. data/specs_e2e/rails_5_2/bin/rails +0 -4
  272. data/specs_e2e/rails_5_2/bin/rake +0 -4
  273. data/specs_e2e/rails_5_2/bin/update +0 -25
  274. data/specs_e2e/rails_5_2/config/application.rb +0 -33
  275. data/specs_e2e/rails_5_2/config/boot.rb +0 -4
  276. data/specs_e2e/rails_5_2/config/credentials.yml.enc +0 -1
  277. data/specs_e2e/rails_5_2/config/environments/production.rb +0 -68
  278. data/specs_e2e/rails_5_2/config/initializers/backtrace_silencers.rb +0 -7
  279. data/specs_e2e/rails_5_2/config/initializers/filter_parameter_logging.rb +0 -4
  280. data/specs_e2e/rails_5_2/config/initializers/mime_types.rb +0 -4
  281. data/specs_e2e/rails_5_2/config/initializers/wrap_parameters.rb +0 -9
  282. data/specs_e2e/rails_5_2/config/master.key +0 -1
  283. data/specs_e2e/rails_5_2/public/favicon.ico +0 -0
  284. data/specs_e2e/rails_5_2/public/robots.txt +0 -1
  285. /data/specs_e2e/{rails_5_2 → rails_6_1}/.gitignore +0 -0
  286. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/controllers/application_controller.rb +0 -0
  287. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/controllers/posts_controller.rb +0 -0
  288. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/helpers/posts_helper.rb +0 -0
  289. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/models/application_record.rb +0 -0
  290. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/models/post.rb +0 -0
  291. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/_form.html.erb +0 -0
  292. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/edit.html.erb +0 -0
  293. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/index.html.erb +0 -0
  294. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/new.html.erb +0 -0
  295. /data/specs_e2e/{rails_5_2 → rails_6_1}/app/views/posts/show.html.erb +0 -0
  296. /data/specs_e2e/{rails_5_2 → rails_6_1}/config/initializers/application_controller_renderer.rb +0 -0
  297. /data/specs_e2e/{rails_5_2 → rails_6_1}/config/initializers/cookies_serializer.rb +0 -0
  298. /data/specs_e2e/{rails_4_2 → rails_6_1}/config/initializers/inflections.rb +0 -0
  299. /data/specs_e2e/{rails_4_2 → rails_6_1}/config/initializers/mime_types.rb +0 -0
  300. /data/specs_e2e/{rails_5_2 → rails_6_1}/config/routes.rb +0 -0
  301. /data/specs_e2e/{rails_5_2 → rails_6_1}/public/404.html +0 -0
  302. /data/specs_e2e/{rails_5_2 → rails_6_1}/public/422.html +0 -0
  303. /data/specs_e2e/{rails_5_2 → rails_6_1}/public/500.html +0 -0
  304. /data/specs_e2e/{rails_5_2 → rails_6_1}/public/apple-touch-icon-precomposed.png +0 -0
  305. /data/specs_e2e/{rails_5_2 → rails_6_1}/public/apple-touch-icon.png +0 -0
  306. /data/specs_e2e/{rails_3_2 → rails_6_1}/public/favicon.ico +0 -0
  307. /data/specs_e2e/{rails_5_2 → rails_6_1}/test/controllers/posts_controller_test.rb +0 -0
  308. /data/specs_e2e/{rails_5_2 → rails_6_1}/test/cypress_fixtures/posts.yml +0 -0
  309. /data/specs_e2e/{rails_5_2 → rails_6_1}/test/fixtures/posts.yml +0 -0
  310. /data/specs_e2e/{rails_5_2 → rails_6_1}/test/models/post_test.rb +0 -0
  311. /data/specs_e2e/{rails_3_2/log → rails_6_1/vendor}/.keep +0 -0
  312. /data/specs_e2e/{rails_3_2/tmp → rails_7_2/vendor}/.keep +0 -0
  313. /data/specs_e2e/{rails_4_2/spec → rails_7_2/vendor/javascript}/.keep +0 -0
  314. /data/specs_e2e/{rails_5_2 → rails_8}/README.md +0 -0
  315. /data/specs_e2e/{rails_4_2/vendor → rails_8/storage}/.keep +0 -0
  316. /data/specs_e2e/{rails_5_2 → rails_8}/vendor/.keep +0 -0
  317. /data/specs_e2e/{rails_3_2/vendor/.gitkeep → rails_8/vendor/javascript/.keep} +0 -0
@@ -1,3 +1,3 @@
1
1
  module CypressOnRails
2
- VERSION = '1.17.0'.freeze
2
+ VERSION = '1.18.0'.freeze
3
3
  end
@@ -6,6 +6,14 @@ if defined?(CypressOnRails)
6
6
  # please use with extra caution if enabling on hosted servers or starting your local server on 0.0.0.0
7
7
  c.use_middleware = !Rails.env.production?
8
8
  <% unless options.experimental %># <% end %> c.use_vcr_middleware = !Rails.env.production?
9
+ <% unless options.experimental %># <% end %> # Use this if you want to use use_cassette wrapper instead of manual insert/eject
10
+ <% unless options.experimental %># <% end %> # c.use_vcr_use_cassette_middleware = !Rails.env.production?
11
+ <% unless options.experimental %># <% end %> # Pass custom VCR options
12
+ <% unless options.experimental %># <% end %> c.vcr_options = {
13
+ <% unless options.experimental %># <% end %> hook_into: :webmock,
14
+ <% unless options.experimental %># <% end %> default_cassette_options: { record: :once },
15
+ <% unless options.experimental %># <% end %> cassette_library_dir: File.expand_path("#{__dir__}/../../<%= options.install_folder %>/<%= options.framework %>/fixtures/vcr_cassettes")
16
+ <% unless options.experimental %># <% end %> }
9
17
  c.logger = Rails.logger
10
18
 
11
19
  # If you want to enable a before_request logic, such as authentication, logging, sending metrics, etc.
@@ -23,3 +23,25 @@
23
23
  //
24
24
  // -- This is will overwrite an existing command --
25
25
  // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
26
+ //
27
+ //
28
+ // -- This is for Graphql usage. Add proxy-like mock to add operation name into query string --
29
+ // Cypress.Commands.add('mockGraphQL', () => {
30
+ // cy.on('window:before:load', (win) => {
31
+ // const originalFetch = win.fetch;
32
+ // const fetch = (path, options, ...rest) => {
33
+ // if (options && options.body) {
34
+ // try {
35
+ // const body = JSON.parse(options.body);
36
+ // if (body.operationName) {
37
+ // return originalFetch(`${path}?operation=${body.operationName}`, options, ...rest);
38
+ // }
39
+ // } catch (e) {
40
+ // return originalFetch(path, options, ...rest);
41
+ // }
42
+ // }
43
+ // return originalFetch(path, options, ...rest);
44
+ // };
45
+ // cy.stub(win, 'fetch', fetch);
46
+ // });
47
+ // });
@@ -47,6 +47,7 @@ Cypress.Commands.add('appFixtures', function (options) {
47
47
  // The next is optional
48
48
  // beforeEach(() => {
49
49
  // cy.app('clean') // have a look at cypress/app_commands/clean.rb
50
+ // cy.mockGraphQL() // for GraphQL usage with use_cassette, see cypress/support/commands.rb
50
51
  // });
51
52
 
52
53
  // comment this out if you do not want to attempt to log additional info on test fail
@@ -36,8 +36,3 @@ CypressOnRails::SmartFactoryWrapper.configure(
36
36
  Rails.root.join('spec', 'factories', '**', '*.rb')
37
37
  ]
38
38
  )
39
-
40
- <% unless options.experimental %># <% end %>require 'vcr'
41
- <% unless options.experimental %># <% end %>VCR.configure do |config|
42
- <% unless options.experimental %># <% end %> config.hook_into :webmock
43
- <% unless options.experimental %># <% end %>end
@@ -9,22 +9,25 @@ RSpec.describe CypressOnRails::Configuration do
9
9
  expect(CypressOnRails.configuration.use_middleware?).to eq(true)
10
10
  expect(CypressOnRails.configuration.logger).to_not be_nil
11
11
  expect(CypressOnRails.configuration.before_request).to_not be_nil
12
+ expect(CypressOnRails.configuration.vcr_options).to eq({})
12
13
  end
13
14
 
14
15
  it 'can be configured' do
15
16
  my_logger = Logger.new(STDOUT)
16
- before_request_lambda = -> (_) { return [200, {}, ['hello world']] }
17
+ before_request_lambda = ->(_) { return [200, {}, ['hello world']] }
17
18
  CypressOnRails.configure do |config|
18
19
  config.api_prefix = '/api'
19
20
  config.install_folder = 'my/path'
20
21
  config.use_middleware = false
21
22
  config.logger = my_logger
22
23
  config.before_request = before_request_lambda
24
+ config.vcr_options = { hook_into: :webmock }
23
25
  end
24
26
  expect(CypressOnRails.configuration.api_prefix).to eq('/api')
25
27
  expect(CypressOnRails.configuration.install_folder).to eq('my/path')
26
28
  expect(CypressOnRails.configuration.use_middleware?).to eq(false)
27
29
  expect(CypressOnRails.configuration.logger).to eq(my_logger)
28
30
  expect(CypressOnRails.configuration.before_request).to eq(before_request_lambda)
31
+ expect(CypressOnRails.configuration.vcr_options).to eq(hook_into: :webmock)
29
32
  end
30
33
  end
@@ -0,0 +1,177 @@
1
+ require 'cypress_on_rails/vcr/insert_eject_middleware'
2
+ require 'vcr'
3
+ require 'active_support/core_ext/hash' unless {}.respond_to?(:symbolize_keys)
4
+
5
+ module CypressOnRails
6
+ module Vcr
7
+ RSpec.describe InsertEjectMiddleware do
8
+ let(:app) { ->(env) { [200, {}, ["app did #{env['PATH_INFO']}"]] } }
9
+ let(:vcr) { class_double(VCR, turn_on!: true, turn_off!: true, insert_cassette: true, eject_cassette: true) }
10
+ subject { described_class.new(app, vcr) }
11
+
12
+ let(:env) { {} }
13
+
14
+ let(:response) { subject.call(env) }
15
+
16
+ def rack_input(json_value)
17
+ StringIO.new(JSON.generate(json_value))
18
+ end
19
+
20
+ describe '/__e2e__/vcr/insert' do
21
+ before do
22
+ env['PATH_INFO'] = '/__e2e__/vcr/insert'
23
+ end
24
+
25
+ it do
26
+ env['rack.input'] = rack_input(['cas1'])
27
+
28
+ aggregate_failures do
29
+ expect(response).to eq([201,
30
+ { 'Content-Type' => 'application/json' },
31
+ ['{"message":"OK"}']])
32
+ expect(vcr).to have_received(:turn_on!)
33
+ expect(vcr).to have_received(:insert_cassette).with('cas1', {})
34
+ end
35
+ end
36
+
37
+ it 'works with record' do
38
+ env['rack.input'] = rack_input(['cas1', { 'record' => 'new_episodes' }])
39
+
40
+ aggregate_failures do
41
+ expect(response).to eq([201,
42
+ { 'Content-Type' => 'application/json' },
43
+ ['{"message":"OK"}']])
44
+ expect(vcr).to have_received(:insert_cassette).with('cas1', record: :new_episodes)
45
+ end
46
+ end
47
+
48
+ it 'works with match_requests_on' do
49
+ env['rack.input'] = rack_input(['cas1', { 'match_requests_on' => %w[method uri] }])
50
+
51
+ aggregate_failures do
52
+ expect(response).to eq([201,
53
+ { 'Content-Type' => 'application/json' },
54
+ ['{"message":"OK"}']])
55
+ expect(vcr).to have_received(:insert_cassette).with('cas1', match_requests_on: %i[method uri])
56
+ end
57
+ end
58
+
59
+ it 'works with serialize_with' do
60
+ env['rack.input'] = rack_input(['cas1', { 'serialize_with' => 'yaml' }])
61
+
62
+ aggregate_failures do
63
+ expect(response).to eq([201,
64
+ { 'Content-Type' => 'application/json' },
65
+ ['{"message":"OK"}']])
66
+ expect(vcr).to have_received(:insert_cassette).with('cas1', serialize_with: :yaml)
67
+ end
68
+ end
69
+
70
+ it 'works with persist_with' do
71
+ env['rack.input'] = rack_input(['cas1', { 'persist_with' => 'file_system' }])
72
+
73
+ aggregate_failures do
74
+ expect(response).to eq([201,
75
+ { 'Content-Type' => 'application/json' },
76
+ ['{"message":"OK"}']])
77
+ expect(vcr).to have_received(:insert_cassette).with('cas1', persist_with: :file_system)
78
+ end
79
+ end
80
+
81
+ context 'when an error occurs' do
82
+ it 'returns a 500 error with the error message' do
83
+ env['rack.input'] = rack_input(['cas1'])
84
+ allow(vcr).to receive(:insert_cassette).and_raise(ArgumentError.new('Invalid cassette name'))
85
+
86
+ expect(response).to eq([
87
+ 500,
88
+ { 'Content-Type' => 'application/json' },
89
+ ['{"message":"Invalid cassette name"}']
90
+ ])
91
+ end
92
+
93
+ it 'returns a 500 error when LoadError occurs' do
94
+ env['rack.input'] = rack_input(['cas1'])
95
+ allow(vcr).to receive(:insert_cassette).and_raise(LoadError.new('Cannot load VCR'))
96
+
97
+ expect(response).to eq([
98
+ 500,
99
+ { 'Content-Type' => 'application/json' },
100
+ ['{"message":"Cannot load VCR"}']
101
+ ])
102
+ end
103
+ end
104
+
105
+ it 'returns a 400 error when JSON parsing fails' do
106
+ env['rack.input'] = StringIO.new('invalid json')
107
+
108
+ expect(response).to eq([
109
+ 400,
110
+ { 'Content-Type' => 'application/json' },
111
+ ['{"message":"unexpected token at \'invalid json\'"}']
112
+ ])
113
+ end
114
+ end
115
+
116
+ describe '/__e2e__/vcr/eject' do
117
+ before do
118
+ env['PATH_INFO'] = '/__e2e__/vcr/eject'
119
+ end
120
+
121
+ it do
122
+ aggregate_failures do
123
+ expect(response).to eq([201,
124
+ { 'Content-Type' => 'application/json' },
125
+ ['{"message":"OK"}']])
126
+ expect(vcr).to have_received(:turn_off!)
127
+ expect(vcr).to have_received(:eject_cassette)
128
+ end
129
+ end
130
+
131
+ context 'when an error occurs' do
132
+ it 'returns a 500 error with the error message' do
133
+ allow(vcr).to receive(:eject_cassette).and_raise(ArgumentError.new('No cassette to eject'))
134
+
135
+ expect(response).to eq([
136
+ 500,
137
+ { 'Content-Type' => 'application/json' },
138
+ ['{"message":"No cassette to eject"}']
139
+ ])
140
+ end
141
+
142
+ it 'returns a 500 error when LoadError occurs' do
143
+ allow(vcr).to receive(:eject_cassette).and_raise(LoadError.new('Cannot load VCR'))
144
+
145
+ expect(response).to eq([
146
+ 500,
147
+ { 'Content-Type' => 'application/json' },
148
+ ['{"message":"Cannot load VCR"}']
149
+ ])
150
+ end
151
+ end
152
+ end
153
+
154
+ describe '"Other paths"' do
155
+ it 'calls vcr turn off the first time' do
156
+ env['PATH_INFO'] = '/test'
157
+
158
+ expect(response).to eq([200, {}, ['app did /test']])
159
+ expect(vcr).to have_received(:turn_off!)
160
+ end
161
+
162
+ it 'runs app' do
163
+ aggregate_failures do
164
+ %w[/ /__e2e__/login command /e2e_command /].each do |path|
165
+ env['PATH_INFO'] = path
166
+
167
+ response = subject.call(env)
168
+
169
+ expect(response).to eq([200, {}, ["app did #{path}"]])
170
+ expect(vcr).to have_received(:turn_off!)
171
+ end
172
+ end
173
+ end
174
+ end
175
+ end
176
+ end
177
+ end
@@ -0,0 +1,68 @@
1
+ require 'cypress_on_rails/vcr/use_cassette_middleware'
2
+ require 'vcr'
3
+ require 'active_support/core_ext/hash' unless {}.respond_to?(:symbolize_keys)
4
+
5
+ module CypressOnRails
6
+ module Vcr
7
+ RSpec.describe UseCassetteMiddleware do
8
+ let(:app) { ->(env) { [200, {}, ["app did #{env['PATH_INFO']}"]] } }
9
+ let(:vcr) { VCR }
10
+ subject { described_class.new(app, vcr) }
11
+
12
+ let(:env) { { 'rack.input' => rack_input([]) } }
13
+
14
+ let(:response) { subject.call(env) }
15
+
16
+ def rack_input(json_value)
17
+ StringIO.new(JSON.generate(json_value))
18
+ end
19
+
20
+ before do
21
+ allow(vcr).to receive(:use_cassette).and_yield
22
+ end
23
+
24
+ it 'returns the application response using correct graphql cassette' do
25
+ env['PATH_INFO'] = '/graphql'
26
+ env['QUERY_STRING'] = 'operation=test'
27
+
28
+ expect(response).to eq([200, {}, ['app did /graphql']])
29
+ expect(vcr).to have_received(:use_cassette).with('/graphql/test')
30
+ end
31
+
32
+ it 'returns the application response using default request path cassette' do
33
+ allow(CypressOnRails).to receive(:configuration).and_return(double(logger: Logger.new(nil)))
34
+ env['PATH_INFO'] = '/test/path'
35
+
36
+ expect(response).to eq([200, {}, ['app did /test/path']])
37
+ expect(vcr).to have_received(:use_cassette).with('/test/path')
38
+ end
39
+
40
+ context 'when VCR cassette library directory does not match' do
41
+ before do
42
+ allow(VCR.configuration).to receive(:cassette_library_dir).and_return('/different/path')
43
+ end
44
+
45
+ it 'returns the application response without using VCR' do
46
+ env['PATH_INFO'] = '/test/path'
47
+
48
+ expect(response).to eq([200, {}, ['app did /test/path']])
49
+ expect(vcr).not_to have_received(:use_cassette)
50
+ end
51
+ end
52
+
53
+ context 'when VCR is not defined' do
54
+ before do
55
+ allow(subject).to receive(:vcr_defined?).and_return(false)
56
+ end
57
+
58
+ it 'returns the application response without error' do
59
+ env['PATH_INFO'] = '/graphql'
60
+ env['QUERY_STRING'] = 'operation=test'
61
+
62
+ expect(response).to eq([200, {}, ['app did /graphql']])
63
+ expect(vcr).to have_received(:use_cassette).with('/graphql/test')
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,10 @@
1
+ # See https://git-scm.com/docs/gitattributes for more about git attribute files.
2
+
3
+ # Mark the database schema as having been generated.
4
+ db/schema.rb linguist-generated
5
+
6
+ # Mark the yarn lockfile as having been generated.
7
+ yarn.lock linguist-generated
8
+
9
+ # Mark any vendored files as having been vendored.
10
+ vendor/* linguist-vendored
@@ -0,0 +1,20 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
5
+ gem 'rails', '~> 6.1.7', '>= 6.1.7.10'
6
+ # Use sqlite3 as the database for Active Record
7
+ gem 'sqlite3', '~> 1.4'
8
+ # Use Puma as the app server
9
+ gem 'puma', '~> 5.0'
10
+
11
+ # Reduces boot times through caching; required in config/boot.rb
12
+ gem 'bootsnap', '>= 1.4.4', require: false
13
+ gem 'concurrent-ruby', '< 1.3.5'
14
+ gem 'date', '~> 3.3.3'
15
+ gem 'timeout', '~> 0.3.2'
16
+
17
+ group :development, :test do
18
+ gem 'cypress-on-rails', path: '../../'
19
+ gem 'database_cleaner'
20
+ end
@@ -1,6 +1,6 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require_relative 'config/application'
4
+ require_relative "config/application"
5
5
 
6
6
  Rails.application.load_tasks
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,7 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ # Automatically retry jobs that encountered a deadlock
3
+ # retry_on ActiveRecord::Deadlocked
4
+
5
+ # Most jobs are safe to ignore if the underlying records are no longer available
6
+ # discard_on ActiveJob::DeserializationError
7
+ end
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>Rails52</title>
4
+ <title>App</title>
5
5
  <%= csrf_meta_tags %>
6
6
  <%= csp_meta_tag %>
7
7
  </head>
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../Gemfile", __dir__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_requirement
64
+ @bundler_requirement ||=
65
+ env_var_version || cli_arg_version ||
66
+ bundler_requirement_for(lockfile_version)
67
+ end
68
+
69
+ def bundler_requirement_for(version)
70
+ return "#{Gem::Requirement.default}.a" unless version
71
+
72
+ bundler_gem_version = Gem::Version.new(version)
73
+
74
+ requirement = bundler_gem_version.approximate_recommendation
75
+
76
+ return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")
77
+
78
+ requirement += ".a" if bundler_gem_version.prerelease?
79
+
80
+ requirement
81
+ end
82
+
83
+ def load_bundler!
84
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
85
+
86
+ activate_bundler
87
+ end
88
+
89
+ def activate_bundler
90
+ gem_error = activation_error_handling do
91
+ gem "bundler", bundler_requirement
92
+ end
93
+ return if gem_error.nil?
94
+ require_error = activation_error_handling do
95
+ require "bundler/version"
96
+ end
97
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99
+ exit 42
100
+ end
101
+
102
+ def activation_error_handling
103
+ yield
104
+ nil
105
+ rescue StandardError, LoadError => e
106
+ e
107
+ end
108
+ end
109
+
110
+ m.load_bundler!
111
+
112
+ if m.invoked_as_script?
113
+ load Gem.bin_path("bundler", "bundle")
114
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ load File.expand_path("spring", __dir__)
3
+ APP_PATH = File.expand_path('../config/application', __dir__)
4
+ require_relative "../config/boot"
5
+ require "rails/commands"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ load File.expand_path("spring", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rake"
5
+ Rake.application.run
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'fileutils'
3
- include FileUtils
2
+ require "fileutils"
4
3
 
5
4
  # path to your application root.
6
5
  APP_ROOT = File.expand_path('..', __dir__)
@@ -9,14 +8,26 @@ def system!(*args)
9
8
  system(*args) || abort("\n== Command #{args} failed ==")
10
9
  end
11
10
 
12
- chdir APP_ROOT do
13
- # This script is a starting point to setup your application.
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to set up or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14
14
  # Add necessary setup steps to this file.
15
15
 
16
16
  puts '== Installing dependencies =='
17
17
  system! 'gem install bundler --conservative'
18
18
  system('bundle check') || system!('bundle install')
19
19
 
20
+ # Install JavaScript dependencies
21
+ system! 'bin/yarn'
22
+
23
+ # puts "\n== Copying sample files =="
24
+ # unless File.exist?('config/database.yml')
25
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
26
+ # end
27
+
28
+ puts "\n== Preparing database =="
29
+ system! 'bin/rails db:prepare'
30
+
20
31
  puts "\n== Removing old logs and tempfiles =="
21
32
  system! 'bin/rails log:clear tmp:clear'
22
33
 
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
3
+ gem "bundler"
4
+ require "bundler"
5
+
6
+ # Load Spring without loading other gems in the Gemfile, for speed.
7
+ Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring|
8
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
9
+ gem "spring", spring.version
10
+ require "spring/binstub"
11
+ rescue Gem::LoadError
12
+ # Ignore when Spring is not installed.
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
+ yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
5
+ select { |dir| File.expand_path(dir) != __dir__ }.
6
+ product(["yarn", "yarn.cmd", "yarn.ps1"]).
7
+ map { |dir, file| File.expand_path(file, dir) }.
8
+ find { |file| File.executable?(file) }
9
+
10
+ if yarn
11
+ exec yarn, *ARGV
12
+ else
13
+ $stderr.puts "Yarn executable was not detected in the system."
14
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
15
+ exit 1
16
+ end
17
+ end
@@ -0,0 +1,34 @@
1
+ require_relative 'boot'
2
+
3
+ require 'logger'
4
+ require 'rails'
5
+ # Pick the frameworks you want:
6
+ require 'active_model/railtie'
7
+ require 'active_job/railtie'
8
+ require 'active_record/railtie'
9
+ require 'active_storage/engine'
10
+ require 'action_controller/railtie'
11
+ require 'action_text/engine'
12
+ require 'action_view/railtie'
13
+ require 'action_cable/engine'
14
+ # require "sprockets/railtie"
15
+ # require "rails/test_unit/railtie"
16
+
17
+ # Require the gems listed in Gemfile, including any gems
18
+ # you've limited to :test, :development, or :production.
19
+ Bundler.require(*Rails.groups)
20
+
21
+ module App
22
+ class Application < Rails::Application
23
+ # Initialize configuration defaults for originally generated Rails version.
24
+ config.load_defaults 6.1
25
+
26
+ # Configuration for the application, engines, and railties goes here.
27
+ #
28
+ # These settings can be overridden in specific environments using the files
29
+ # in config/environments, which are processed later.
30
+ #
31
+ # config.time_zone = "Central Time (US & Canada)"
32
+ # config.eager_load_paths << Rails.root.join("extras")
33
+ end
34
+ end
@@ -0,0 +1,4 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
4
+ require "bootsnap/setup" # Speed up boot time by caching expensive operations.
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: test
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: app_production