cypress-on-rails 1.12.1 → 1.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +3 -3
  3. data/.gitignore +4 -1
  4. data/CHANGELOG.md +13 -0
  5. data/README.md +91 -5
  6. data/cypress-on-rails.gemspec +1 -0
  7. data/lib/cypress-on-rails.rb +2 -2
  8. data/lib/cypress_on_rails/configuration.rb +3 -0
  9. data/lib/cypress_on_rails/middleware.rb +6 -10
  10. data/lib/cypress_on_rails/middleware_config.rb +17 -0
  11. data/lib/cypress_on_rails/railtie.rb +5 -1
  12. data/lib/cypress_on_rails/vcr_middleware.rb +73 -0
  13. data/lib/cypress_on_rails/version.rb +1 -1
  14. data/lib/generators/cypress_on_rails/install_generator.rb +18 -24
  15. data/lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb +1 -0
  16. data/lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/clean.rb +6 -0
  17. data/lib/generators/cypress_on_rails/templates/spec/cypress/{cypress_helper.rb → cypress_helper.rb.erb} +5 -0
  18. data/lib/generators/cypress_on_rails/templates/spec/cypress/e2e/rails_examples/using_vcr.cy.js +24 -0
  19. data/lib/generators/cypress_on_rails/templates/spec/cypress/support/{index.js → index.js.erb} +1 -0
  20. data/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js +1 -1
  21. data/lib/generators/cypress_on_rails/templates/spec/cypress.config.js +9 -0
  22. data/plugin/.gitignore +1 -0
  23. data/plugin/cypress/plugins/index.js +4 -0
  24. data/plugin/package.json +31 -0
  25. data/plugin/support/index.js +37 -0
  26. data/spec/cypress_on_rails/middleware_spec.rb +3 -1
  27. data/spec/cypress_on_rails/vcr_middleware_spec.rb +119 -0
  28. data/specs_e2e/cypress.config.js +10 -0
  29. data/{spec/integrations → specs_e2e}/rails_3_2/.gitignore +1 -1
  30. data/specs_e2e/rails_3_2/.ruby_version +1 -0
  31. data/{spec/integrations → specs_e2e}/rails_3_2/Gemfile +1 -1
  32. data/{spec/integrations → specs_e2e}/rails_3_2/test.sh +8 -7
  33. data/{spec/integrations → specs_e2e}/rails_4_2/.gitignore +3 -2
  34. data/{spec/integrations → specs_e2e}/rails_4_2/Gemfile +3 -1
  35. data/specs_e2e/rails_4_2/app/controllers/using_vcr_controller.rb +10 -0
  36. data/{spec/integrations → specs_e2e}/rails_4_2/app/models/post.rb +3 -1
  37. data/specs_e2e/rails_4_2/app/views/using_vcr/index.html.erb +6 -0
  38. data/specs_e2e/rails_4_2/app/views/using_vcr/record_cats.html.erb +7 -0
  39. data/{spec/integrations → specs_e2e}/rails_4_2/config/routes.rb +5 -0
  40. data/specs_e2e/rails_4_2/package.json +10 -0
  41. data/{spec/integrations → specs_e2e}/rails_4_2/test.sh +13 -12
  42. data/{spec/integrations → specs_e2e}/rails_5_2/.gitignore +1 -1
  43. data/{spec/integrations → specs_e2e}/rails_5_2/Gemfile +1 -1
  44. data/specs_e2e/rails_5_2/app/assets/javascripts/posts.js +2 -0
  45. data/specs_e2e/rails_5_2/app/assets/stylesheets/posts.css +4 -0
  46. data/{spec/integrations → specs_e2e}/rails_5_2/test.sh +8 -7
  47. metadata +177 -171
  48. data/lib/generators/cypress_on_rails/templates/spec/cypress/fixtures/example.json +0 -5
  49. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/actions.spec.js +0 -272
  50. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/aliasing.spec.js +0 -42
  51. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/assertions.spec.js +0 -63
  52. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/connectors.spec.js +0 -55
  53. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cookies.spec.js +0 -78
  54. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cypress_api.spec.js +0 -211
  55. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/files.spec.js +0 -86
  56. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/local_storage.spec.js +0 -52
  57. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/location.spec.js +0 -32
  58. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js +0 -68
  59. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/navigation.spec.js +0 -54
  60. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/network_requests.spec.js +0 -108
  61. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/querying.spec.js +0 -65
  62. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/spies_stubs_clocks.spec.js +0 -62
  63. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/traversal.spec.js +0 -121
  64. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/utilities.spec.js +0 -89
  65. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/viewport.spec.js +0 -59
  66. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/waiting.spec.js +0 -34
  67. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/window.spec.js +0 -22
  68. data/lib/generators/cypress_on_rails/templates/spec/cypress.json +0 -4
  69. data/spec/integrations/cypress.json +0 -5
  70. data/spec/integrations/rails_5_2/log/.keep +0 -0
  71. data/spec/integrations/rails_5_2/tmp/.keep +0 -0
  72. data/spec/integrations/rails_5_2/vendor/.keep +0 -0
  73. /data/lib/generators/cypress_on_rails/templates/spec/cypress/{integration/rails_examples/advance_factory_bot_spec.js → e2e/rails_examples/advance_factory_bot.cy.js} +0 -0
  74. /data/lib/generators/cypress_on_rails/templates/spec/cypress/{integration/rails_examples/other_spec.js → e2e/rails_examples/other.cy.js} +0 -0
  75. /data/lib/generators/cypress_on_rails/templates/spec/cypress/{integration/rails_examples/using_factory_bot_spec.js → e2e/rails_examples/using_factory_bot.cy.js} +0 -0
  76. /data/lib/generators/cypress_on_rails/templates/spec/cypress/{integration/rails_examples/using_fixtures_spec.js → e2e/rails_examples/using_fixtures.cy.js} +0 -0
  77. /data/lib/generators/cypress_on_rails/templates/spec/cypress/{integration/rails_examples/using_scenarios_spec.js → e2e/rails_examples/using_scenarios.cy.js} +0 -0
  78. /data/{spec/integrations → specs_e2e}/rails_3_2/README.rdoc +0 -0
  79. /data/{spec/integrations → specs_e2e}/rails_3_2/Rakefile +0 -0
  80. /data/{spec/integrations → specs_e2e}/rails_3_2/app/assets/stylesheets/application.css +0 -0
  81. /data/{spec/integrations → specs_e2e}/rails_3_2/app/controllers/application_controller.rb +0 -0
  82. /data/{spec/integrations → specs_e2e}/rails_3_2/app/controllers/welcome_controller.rb +0 -0
  83. /data/{spec/integrations → specs_e2e}/rails_3_2/app/helpers/application_helper.rb +0 -0
  84. /data/{spec/integrations → specs_e2e}/rails_3_2/app/models/post.rb +0 -0
  85. /data/{spec/integrations → specs_e2e}/rails_3_2/app/views/layouts/application.html.erb +0 -0
  86. /data/{spec/integrations → specs_e2e}/rails_3_2/app/views/welcome/index.html.erb +0 -0
  87. /data/{spec/integrations → specs_e2e}/rails_3_2/bin/rails +0 -0
  88. /data/{spec/integrations → specs_e2e}/rails_3_2/config/application.rb +0 -0
  89. /data/{spec/integrations → specs_e2e}/rails_3_2/config/boot.rb +0 -0
  90. /data/{spec/integrations → specs_e2e}/rails_3_2/config/environment.rb +0 -0
  91. /data/{spec/integrations → specs_e2e}/rails_3_2/config/environments/development.rb +0 -0
  92. /data/{spec/integrations → specs_e2e}/rails_3_2/config/environments/production.rb +0 -0
  93. /data/{spec/integrations → specs_e2e}/rails_3_2/config/environments/test.rb +0 -0
  94. /data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/backtrace_silencers.rb +0 -0
  95. /data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/inflections.rb +0 -0
  96. /data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/mime_types.rb +0 -0
  97. /data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/secret_token.rb +0 -0
  98. /data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/session_store.rb +0 -0
  99. /data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/wrap_parameters.rb +0 -0
  100. /data/{spec/integrations → specs_e2e}/rails_3_2/config/locales/en.yml +0 -0
  101. /data/{spec/integrations → specs_e2e}/rails_3_2/config/routes.rb +0 -0
  102. /data/{spec/integrations → specs_e2e}/rails_3_2/config.ru +0 -0
  103. /data/{spec/integrations → specs_e2e}/rails_3_2/log/.keep +0 -0
  104. /data/{spec/integrations → specs_e2e}/rails_3_2/public/404.html +0 -0
  105. /data/{spec/integrations → specs_e2e}/rails_3_2/public/422.html +0 -0
  106. /data/{spec/integrations → specs_e2e}/rails_3_2/public/500.html +0 -0
  107. /data/{spec/integrations → specs_e2e}/rails_3_2/public/favicon.ico +0 -0
  108. /data/{spec/integrations → specs_e2e}/rails_3_2/public/robots.txt +0 -0
  109. /data/{spec/integrations → specs_e2e}/rails_3_2/tmp/.keep +0 -0
  110. /data/{spec/integrations → specs_e2e}/rails_3_2/vendor/.gitkeep +0 -0
  111. /data/{spec/integrations → specs_e2e}/rails_4_2/README.rdoc +0 -0
  112. /data/{spec/integrations → specs_e2e}/rails_4_2/Rakefile +0 -0
  113. /data/{spec/integrations/rails_5_2/app/assets/javascripts/posts.js → specs_e2e/rails_4_2/app/assets/javascripts/using_vcr.js} +0 -0
  114. /data/{spec/integrations/rails_5_2/app/assets/stylesheets/posts.css → specs_e2e/rails_4_2/app/assets/stylesheets/using_vcr.css} +0 -0
  115. /data/{spec/integrations → specs_e2e}/rails_4_2/app/controllers/application_controller.rb +0 -0
  116. /data/{spec/integrations → specs_e2e}/rails_4_2/app/controllers/welcome_controller.rb +0 -0
  117. /data/{spec/integrations → specs_e2e}/rails_4_2/app/views/layouts/application.html.erb +0 -0
  118. /data/{spec/integrations → specs_e2e}/rails_4_2/app/views/welcome/index.html.erb +0 -0
  119. /data/{spec/integrations → specs_e2e}/rails_4_2/bin/bundle +0 -0
  120. /data/{spec/integrations → specs_e2e}/rails_4_2/bin/rails +0 -0
  121. /data/{spec/integrations → specs_e2e}/rails_4_2/bin/rake +0 -0
  122. /data/{spec/integrations → specs_e2e}/rails_4_2/bin/setup +0 -0
  123. /data/{spec/integrations → specs_e2e}/rails_4_2/config/application.rb +0 -0
  124. /data/{spec/integrations → specs_e2e}/rails_4_2/config/boot.rb +0 -0
  125. /data/{spec/integrations → specs_e2e}/rails_4_2/config/environment.rb +0 -0
  126. /data/{spec/integrations → specs_e2e}/rails_4_2/config/environments/development.rb +0 -0
  127. /data/{spec/integrations → specs_e2e}/rails_4_2/config/environments/production.rb +0 -0
  128. /data/{spec/integrations → specs_e2e}/rails_4_2/config/environments/test.rb +0 -0
  129. /data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/backtrace_silencers.rb +0 -0
  130. /data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/cookies_serializer.rb +0 -0
  131. /data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/filter_parameter_logging.rb +0 -0
  132. /data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/inflections.rb +0 -0
  133. /data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/mime_types.rb +0 -0
  134. /data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/session_store.rb +0 -0
  135. /data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/to_time_preserves_timezone.rb +0 -0
  136. /data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/wrap_parameters.rb +0 -0
  137. /data/{spec/integrations → specs_e2e}/rails_4_2/config/locales/en.yml +0 -0
  138. /data/{spec/integrations → specs_e2e}/rails_4_2/config/secrets.yml +0 -0
  139. /data/{spec/integrations → specs_e2e}/rails_4_2/config.ru +0 -0
  140. /data/{spec/integrations → specs_e2e}/rails_4_2/public/404.html +0 -0
  141. /data/{spec/integrations → specs_e2e}/rails_4_2/public/422.html +0 -0
  142. /data/{spec/integrations → specs_e2e}/rails_4_2/public/500.html +0 -0
  143. /data/{spec/integrations → specs_e2e}/rails_4_2/public/favicon.ico +0 -0
  144. /data/{spec/integrations → specs_e2e}/rails_4_2/public/robots.txt +0 -0
  145. /data/{spec/integrations/rails_4_2/log → specs_e2e/rails_4_2/spec}/.keep +0 -0
  146. /data/{spec/integrations/rails_4_2/spec → specs_e2e/rails_4_2/vendor}/.keep +0 -0
  147. /data/{spec/integrations → specs_e2e}/rails_5_2/README.md +0 -0
  148. /data/{spec/integrations → specs_e2e}/rails_5_2/Rakefile +0 -0
  149. /data/{spec/integrations → specs_e2e}/rails_5_2/app/assets/stylesheets/scaffold.css +0 -0
  150. /data/{spec/integrations → specs_e2e}/rails_5_2/app/controllers/application_controller.rb +0 -0
  151. /data/{spec/integrations → specs_e2e}/rails_5_2/app/controllers/posts_controller.rb +0 -0
  152. /data/{spec/integrations → specs_e2e}/rails_5_2/app/helpers/posts_helper.rb +0 -0
  153. /data/{spec/integrations → specs_e2e}/rails_5_2/app/jobs/application_job.rb +0 -0
  154. /data/{spec/integrations → specs_e2e}/rails_5_2/app/models/application_record.rb +0 -0
  155. /data/{spec/integrations → specs_e2e}/rails_5_2/app/models/post.rb +0 -0
  156. /data/{spec/integrations → specs_e2e}/rails_5_2/app/views/layouts/application.html.erb +0 -0
  157. /data/{spec/integrations → specs_e2e}/rails_5_2/app/views/posts/_form.html.erb +0 -0
  158. /data/{spec/integrations → specs_e2e}/rails_5_2/app/views/posts/edit.html.erb +0 -0
  159. /data/{spec/integrations → specs_e2e}/rails_5_2/app/views/posts/index.html.erb +0 -0
  160. /data/{spec/integrations → specs_e2e}/rails_5_2/app/views/posts/new.html.erb +0 -0
  161. /data/{spec/integrations → specs_e2e}/rails_5_2/app/views/posts/show.html.erb +0 -0
  162. /data/{spec/integrations → specs_e2e}/rails_5_2/app/views/welcome/index.html.erb +0 -0
  163. /data/{spec/integrations → specs_e2e}/rails_5_2/bin/bundle +0 -0
  164. /data/{spec/integrations → specs_e2e}/rails_5_2/bin/rails +0 -0
  165. /data/{spec/integrations → specs_e2e}/rails_5_2/bin/rake +0 -0
  166. /data/{spec/integrations → specs_e2e}/rails_5_2/bin/setup +0 -0
  167. /data/{spec/integrations → specs_e2e}/rails_5_2/bin/update +0 -0
  168. /data/{spec/integrations → specs_e2e}/rails_5_2/config/application.rb +0 -0
  169. /data/{spec/integrations → specs_e2e}/rails_5_2/config/boot.rb +0 -0
  170. /data/{spec/integrations → specs_e2e}/rails_5_2/config/credentials.yml.enc +0 -0
  171. /data/{spec/integrations → specs_e2e}/rails_5_2/config/database.yml +0 -0
  172. /data/{spec/integrations → specs_e2e}/rails_5_2/config/environment.rb +0 -0
  173. /data/{spec/integrations → specs_e2e}/rails_5_2/config/environments/development.rb +0 -0
  174. /data/{spec/integrations → specs_e2e}/rails_5_2/config/environments/production.rb +0 -0
  175. /data/{spec/integrations → specs_e2e}/rails_5_2/config/environments/test.rb +0 -0
  176. /data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/application_controller_renderer.rb +0 -0
  177. /data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/backtrace_silencers.rb +0 -0
  178. /data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/content_security_policy.rb +0 -0
  179. /data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/cookies_serializer.rb +0 -0
  180. /data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/filter_parameter_logging.rb +0 -0
  181. /data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/inflections.rb +0 -0
  182. /data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/mime_types.rb +0 -0
  183. /data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/wrap_parameters.rb +0 -0
  184. /data/{spec/integrations → specs_e2e}/rails_5_2/config/locales/en.yml +0 -0
  185. /data/{spec/integrations → specs_e2e}/rails_5_2/config/master.key +0 -0
  186. /data/{spec/integrations → specs_e2e}/rails_5_2/config/routes.rb +0 -0
  187. /data/{spec/integrations → specs_e2e}/rails_5_2/config.ru +0 -0
  188. /data/{spec/integrations → specs_e2e}/rails_5_2/db/migrate/20180621085832_create_posts.rb +0 -0
  189. /data/{spec/integrations → specs_e2e}/rails_5_2/public/404.html +0 -0
  190. /data/{spec/integrations → specs_e2e}/rails_5_2/public/422.html +0 -0
  191. /data/{spec/integrations → specs_e2e}/rails_5_2/public/500.html +0 -0
  192. /data/{spec/integrations → specs_e2e}/rails_5_2/public/apple-touch-icon-precomposed.png +0 -0
  193. /data/{spec/integrations → specs_e2e}/rails_5_2/public/apple-touch-icon.png +0 -0
  194. /data/{spec/integrations → specs_e2e}/rails_5_2/public/favicon.ico +0 -0
  195. /data/{spec/integrations → specs_e2e}/rails_5_2/public/robots.txt +0 -0
  196. /data/{spec/integrations → specs_e2e}/rails_5_2/test/controllers/posts_controller_test.rb +0 -0
  197. /data/{spec/integrations → specs_e2e}/rails_5_2/test/cypress_fixtures/posts.yml +0 -0
  198. /data/{spec/integrations → specs_e2e}/rails_5_2/test/fixtures/posts.yml +0 -0
  199. /data/{spec/integrations → specs_e2e}/rails_5_2/test/models/post_test.rb +0 -0
  200. /data/{spec/integrations/rails_4_2 → specs_e2e/rails_5_2}/vendor/.keep +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32a416c65647445473bce7bcf306bda04eafb673d8d4af20c795f13692f4da8e
4
- data.tar.gz: ee456e7396cfa0d94cc9cd80d0a54dc6c89248254c3855b66578f8e214a0982d
3
+ metadata.gz: f65fc72c40d5d7016113ff6af471a1557de37b794a6812d8a03bcd9f16d78917
4
+ data.tar.gz: 14fc7d218866e99cd51970b587782d9a66eca9dc7face4b497f3035c3e17a587
5
5
  SHA512:
6
- metadata.gz: 4022aeb303bf3fa6514cd2b221869bb531e7e0be1b85de8f35ba20f6e5d2ff9fc8062ab2560a7d71d17ce0931719c3e57a33b23b25e3fa3ddb60a02de579c527
7
- data.tar.gz: 18d9b6423eb5fafbf2bf756de4b9e72fc8a5dc8b0240a15a1598e97f16acac6e589ff591493158ced0779374a27a347525c75eb4b4d1b9b2dd16364276afd10d
6
+ metadata.gz: ac7fd90c3ba3748bb4a4aaae00615abfad1f2046fd8358f1d674e3e9086abd34489fd1b07fec4c043fd9e588600aaf9f6bc3c0328c7cdf99b598d221d710a7f6
7
+ data.tar.gz: 7b7d371e24aea239174384b9f5fddfa218739e15f5f01256f42821f6ebfbaf42e914404b8dfeab68e77444792ca79226c6f756cbc23e1833dc6d47db2935c215
@@ -22,7 +22,7 @@ jobs:
22
22
  - run: gem uninstall -v '>= 2' -ax bundler || true
23
23
  - run: gem install bundler -v '< 2'
24
24
  - name: Run interaction tests
25
- run: ./spec/integrations/rails_3_2/test.sh
25
+ run: ./specs_e2e/rails_3_2/test.sh
26
26
 
27
27
  rails_4_2:
28
28
  runs-on: ubuntu-latest
@@ -39,7 +39,7 @@ jobs:
39
39
  - run: gem uninstall -v '>= 2' -ax bundler || true
40
40
  - run: gem install bundler -v '< 2'
41
41
  - name: Run interaction tests
42
- run: ./spec/integrations/rails_4_2/test.sh
42
+ run: ./specs_e2e/rails_4_2/test.sh
43
43
 
44
44
  rails_5_2:
45
45
  runs-on: ubuntu-latest
@@ -54,4 +54,4 @@ jobs:
54
54
  - name: Run tests
55
55
  run: bundle exec rake
56
56
  - name: Run interaction tests
57
- run: ./spec/integrations/rails_5_2/test.sh
57
+ run: ./specs_e2e/rails_5_2/test.sh
data/.gitignore CHANGED
@@ -6,4 +6,7 @@ spec/examples.txt
6
6
  spec/test.log
7
7
  pkg/*.gem
8
8
  vendor/bundle
9
- .vscode
9
+ .vscode
10
+ node_modules
11
+ package-lock.json
12
+ yarn.lock
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## [1.13.1]
2
+ [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.13.0...v1.13.1
3
+
4
+ ### Fixed
5
+ * use_vcr_middleware disabled by default [PR 109](https://github.com/shakacode/cypress-on-rails/pull/109)
6
+
7
+ ## [1.13.0]
8
+ [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.12.1...v1.13.0
9
+
10
+ ### Changed
11
+ * Add support for matching npm package and VCR
12
+ * generate for cypress 10 [PR 108](https://github.com/shakacode/cypress-on-rails/pull/108)
13
+
1
14
  ## [1.12.1]
2
15
  [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.12.0...v1.12.1
3
16
 
data/README.md CHANGED
@@ -9,6 +9,8 @@ This project is sponsored by the software consulting firm [ShakaCode](https://ww
9
9
 
10
10
  Interested in joining a small team that loves open source? Check our [careers page](https://www.shakacode.com/career/).
11
11
 
12
+ Need help with cypress-on-rails? Contact [ShakaCode](mailto:justin@shakacode.com).
13
+
12
14
  ----
13
15
 
14
16
  # Totally new to Cypress?
@@ -69,7 +71,7 @@ bin/rails g cypress_on_rails:update
69
71
  The generator modifies/adds the following files/directory in your application:
70
72
  * `config/environments/test.rb`
71
73
  * `config/initializers/cypress_on_rails` used to configure CypressDev
72
- * `spec/cypress/integrations/` contains your cypress tests
74
+ * `spec/cypress/e2e/` contains your cypress tests
73
75
  * `spec/cypress/support/on-rails.js` contains CypressDev support code
74
76
  * `spec/cypress/app_commands/scenarios/` contains your CypressDev scenario definitions
75
77
  * `spec/cypress/cypress_helper.rb` contains helper code for CypressDev app commands
@@ -133,7 +135,7 @@ node_modules/.bin/cypress run
133
135
  You can run your [factory_bot](https://github.com/thoughtbot/factory_bot) directly as well
134
136
 
135
137
  ```js
136
- // spec/cypress/integrations/simple_spec.js
138
+ // spec/cypress/e2e/simple.cy.js
137
139
  describe('My First Test', function() {
138
140
  it('visit root', function() {
139
141
  // This calls to the backend to prepare the application state
@@ -207,7 +209,7 @@ ActiveRecord::FixtureSet.create_fixtures(fixtures_dir, fixture_files)
207
209
  ```
208
210
 
209
211
  ```js
210
- // spec/cypress/integrations/simple_spec.js
212
+ // spec/cypress/e2e/simple.cy.js
211
213
  describe('My First Test', function() {
212
214
  it('visit root', function() {
213
215
  // This calls to the backend to prepare the application state
@@ -236,7 +238,7 @@ CypressOnRails::SmartFactoryWrapper.create(:profile, name: "Cypress Hill")
236
238
 
237
239
  Then reference the scenario in your test:
238
240
  ```js
239
- // spec/cypress/integrations/scenario_example_spec.js
241
+ // spec/cypress/e2e/scenario_example.cy.js
240
242
  describe('My First Test', function() {
241
243
  it('visit root', function() {
242
244
  // This calls to the backend to prepare the application state
@@ -259,7 +261,7 @@ load "#{Rails.root}/db/seeds.rb"
259
261
 
260
262
  Then reference the command in your test with `cy.app('load_seed')`:
261
263
  ```js
262
- // spec/cypress/integrations/simple_spec.js
264
+ // spec/cypress/e2e/simple.cy.js
263
265
  describe('My First Test', function() {
264
266
  beforeEach(() => { cy.app('load_seed') })
265
267
 
@@ -271,6 +273,78 @@ describe('My First Test', function() {
271
273
  })
272
274
  ```
273
275
 
276
+ ## Expermintal Features (matching npm package)
277
+
278
+ Please test and give feedback
279
+
280
+ add the npm package:
281
+
282
+ ```
283
+ yarn add cypress-on-rails --dev
284
+ ```
285
+
286
+ ### for VCR
287
+
288
+ This only works when you start the rails server with a single worker and single thread
289
+
290
+ #### setup
291
+
292
+ Add your VCR configuration to your `cypress_helper.rb`
293
+
294
+ ```ruby
295
+ require 'vcr'
296
+ VCR.configure do |config|
297
+ config.hook_into :webmock
298
+ end
299
+ ```
300
+
301
+ Add to you `cypress/support/index.js`
302
+
303
+ ```js
304
+ import 'cypress-on-rails/support/index'
305
+ ```
306
+
307
+ Add to you `clean.rb`
308
+
309
+ ```ruby
310
+ VCR.eject_cassette # make sure we no cassettes inserted before the next test starts
311
+ VCR.turn_off!
312
+ WebMock.disable! if defined?(WebMock)
313
+ ```
314
+
315
+ Add to you `config/cypress_on_rails.rb`
316
+
317
+ ```ruby
318
+ c.use_vcr_middleware = !Rails.env.production? && ENV['CYPRESS'].present?
319
+ ```
320
+
321
+ #### usage
322
+
323
+ You have `vcr_insert_cassette` and `vcr_eject_cassette` available. https://www.rubydoc.info/github/vcr/vcr/VCR:insert_cassette
324
+
325
+
326
+ ```js
327
+ describe('My First Test', function() {
328
+ beforeEach(() => { cy.app('load_seed') })
329
+
330
+ it('visit root', function() {
331
+ cy.app('clean') // have a look at cypress/app_commands/clean.rb
332
+
333
+ cy.vcr_insert_cassette('cats', { record: "new_episodes" })
334
+ cy.visit('/using_vcr/index')
335
+
336
+ cy.get('a').contains('Cats').click()
337
+ cy.contains('Wikipedia has a recording of a cat meowing, because why not?')
338
+
339
+ cy.vcr_eject_cassette();
340
+
341
+ cy.vcr_insert_cassette('cats')
342
+ cy.visit('/using_vcr/record_cats')
343
+ cy.contains('Wikipedia has a recording of a cat meowing, because why not?')
344
+ })
345
+ })
346
+ ```
347
+
274
348
  ## Usage with other rack applications
275
349
 
276
350
  Add CypressOnRails to your config.ru
@@ -329,3 +403,15 @@ beforeEach(() => {
329
403
  3. Commit your changes (`git commit -am 'Add some feature'`)
330
404
  4. Push to the branch (`git push origin my-new-feature`)
331
405
  5. Create a new Pull Request
406
+
407
+ # Supporters
408
+
409
+ The following companies support this open source project, and ShakaCode uses their products! Justin writes React on Rails on [RubyMine](https://www.jetbrains.com/ruby/). We use [Scout](https://scoutapp.com/) to monitor the live performance of [HiChee.com](https://HiChee.com), [Rails AutoScale](https://railsautoscale.com) to scale the dynos of HiChee, and [HoneyBadger](https://www.honeybadger.io/) to monitor application errors. We love [BrowserStack](https://www.browserstack.com) to solve problems with oddball browsers.
410
+
411
+ [![RubyMine](https://user-images.githubusercontent.com/1118459/114100597-3b0e3000-9860-11eb-9b12-73beb1a184b2.png)](https://www.jetbrains.com/ruby/)
412
+ [![Scout](https://user-images.githubusercontent.com/1118459/171088197-81555b69-9ed0-4235-9acf-fcb37ecfb949.png)](https://scoutapp.com/)
413
+ [![Rails AutoScale](https://user-images.githubusercontent.com/1118459/103197530-48dc0e80-488a-11eb-8b1b-a16664b30274.png)](https://railsautoscale.com/)
414
+ [![BrowserStack](https://cloud.githubusercontent.com/assets/1118459/23203304/1261e468-f886-11e6-819e-93b1a3f17da4.png)](https://www.browserstack.com)
415
+ [![HoneyBadger](https://user-images.githubusercontent.com/1118459/114100696-63962a00-9860-11eb-8ac1-75ca02856d8e.png)](https://www.honeybadger.io/)
416
+
417
+ ShakaCode's favorite project tracking tool is [Shortcut](https://shortcut.com/). If you want to **try Shortcut and get 2 months free beyond the 14-day trial period**, click [here to use ShakaCode's referral code](http://r.clbh.se/mvfoNeH). We're participating in their awesome triple-sided referral program, which you can read about [here](https://shortcut.com/referral/). By using our [referral code](http://r.clbh.se/mvfoNeH) you'll be supporting ShakaCode and, thus, React on Rails!
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_development_dependency 'rspec'
21
21
  s.add_development_dependency 'railties', '>= 3.2'
22
22
  s.add_development_dependency 'factory_bot'
23
+ s.add_development_dependency 'vcr'
23
24
  s.metadata = {
24
25
  "bug_tracker_uri" => "https://github.com/shakacode/cypress-on-rails/issues",
25
26
  "changelog_uri" => "https://github.com/shakacode/cypress-on-rails/blob/master/CHANGELOG.md",
@@ -3,5 +3,5 @@ require 'cypress_on_rails/configuration'
3
3
  require_relative './cypress_on_rails/railtie' if defined?(Rails)
4
4
 
5
5
  # maintain backward compatibility
6
- CypressDev = CypressOnRails
7
- Cypress = CypressDev
6
+ CypressDev = CypressOnRails unless defined?(CypressDev)
7
+ Cypress = CypressDev unless defined?(Cypress)
@@ -4,6 +4,7 @@ module CypressOnRails
4
4
  class Configuration
5
5
  attr_accessor :cypress_folder
6
6
  attr_accessor :use_middleware
7
+ attr_accessor :use_vcr_middleware
7
8
  attr_accessor :logger
8
9
 
9
10
  def initialize
@@ -11,10 +12,12 @@ module CypressOnRails
11
12
  end
12
13
 
13
14
  alias :use_middleware? :use_middleware
15
+ alias :use_vcr_middleware? :use_vcr_middleware
14
16
 
15
17
  def reset
16
18
  self.cypress_folder = 'spec/cypress'
17
19
  self.use_middleware = true
20
+ self.use_vcr_middleware = false
18
21
  self.logger = Logger.new(STDOUT)
19
22
  end
20
23
 
@@ -1,11 +1,13 @@
1
1
  require 'json'
2
2
  require 'rack'
3
- require 'cypress_on_rails/configuration'
3
+ require 'cypress_on_rails/middleware_config'
4
4
  require 'cypress_on_rails/command_executor'
5
5
 
6
6
  module CypressOnRails
7
7
  # Middleware to handle cypress commands and eval
8
8
  class Middleware
9
+ include MiddlewareConfig
10
+
9
11
  def initialize(app, command_executor = CommandExecutor, file = ::File)
10
12
  @app = app
11
13
  @command_executor = command_executor
@@ -23,14 +25,6 @@ module CypressOnRails
23
25
 
24
26
  private
25
27
 
26
- def configuration
27
- CypressOnRails.configuration
28
- end
29
-
30
- def logger
31
- configuration.logger
32
- end
33
-
34
28
  Command = Struct.new(:name, :options, :cypress_folder) do
35
29
  # @return [Array<Cypress::Middleware::Command>]
36
30
  def self.from_body(body, configuration)
@@ -65,13 +59,15 @@ module CypressOnRails
65
59
  output = {"message" => "Cannot convert to json"}.to_json
66
60
  end
67
61
 
62
+ logger.debug "output: #{output}"
68
63
  [201, {'Content-Type' => 'application/json'}, [output]]
69
64
  rescue => e
70
65
  output = {"message" => e.message, "class" => e.class.to_s}.to_json
71
66
  [500, {'Content-Type' => 'application/json'}, [output]]
72
67
  end
73
68
  else
74
- [404, {}, ["could not find command file: #{missing_command.file_path}"]]
69
+ output = {"message" => "could not find command file: #{missing_command.file_path}"}.to_json
70
+ [404, {'Content-Type' => 'application/json'}, [output]]
75
71
  end
76
72
  end
77
73
  end
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+ require 'rack'
3
+ require 'cypress_on_rails/configuration'
4
+
5
+ module CypressOnRails
6
+ module MiddlewareConfig
7
+ protected
8
+
9
+ def configuration
10
+ CypressOnRails.configuration
11
+ end
12
+
13
+ def logger
14
+ configuration.logger
15
+ end
16
+ end
17
+ end
@@ -1,13 +1,17 @@
1
1
  require 'rails/railtie'
2
2
  require 'cypress_on_rails/configuration'
3
- require 'cypress_on_rails/middleware'
4
3
 
5
4
  module CypressOnRails
6
5
  class Railtie < Rails::Railtie
7
6
  initializer :setup_cypress_middleware, after: :load_config_initializers do |app|
8
7
  if CypressOnRails.configuration.use_middleware?
8
+ require 'cypress_on_rails/middleware'
9
9
  app.middleware.use Middleware
10
10
  end
11
+ if CypressOnRails.configuration.use_vcr_middleware?
12
+ require 'cypress_on_rails/vcr_middleware'
13
+ app.middleware.use VCRMiddleware
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -0,0 +1,73 @@
1
+ require 'json'
2
+ require 'rack'
3
+ require 'cypress_on_rails/middleware_config'
4
+
5
+ module CypressOnRails
6
+ # Middleware to handle vcr
7
+ class VCRMiddleware
8
+ include MiddlewareConfig
9
+
10
+ def initialize(app, vcr = nil)
11
+ @app = app
12
+ @vcr = vcr
13
+ @first_call = false
14
+ end
15
+
16
+ def call(env)
17
+ request = Rack::Request.new(env)
18
+ if request.path.start_with?('/__cypress__/vcr/insert')
19
+ configuration.tagged_logged { handle_insert(request) }
20
+ elsif request.path.start_with?('/__cypress__/vcr/eject')
21
+ configuration.tagged_logged { handle_eject }
22
+ else
23
+ do_first_call unless @first_call
24
+ @app.call(env)
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def handle_insert(req)
31
+ WebMock.enable! if defined?(WebMock)
32
+ vcr.turn_on!
33
+ body = JSON.parse(req.body.read)
34
+ logger.info "vcr insert cassette: #{body}"
35
+ cassette_name = body[0]
36
+ options = (body[1] || {}).symbolize_keys
37
+ options[:record] = options[:record].to_sym if options[:record]
38
+ options[:match_requests_on] = options[:match_requests_on].map(&:to_sym) if options[:match_requests_on]
39
+ options[:serialize_with] = options[:serialize_with].to_sym if options[:serialize_with]
40
+ options[:persist_with] = options[:persist_with].to_sym if options[:persist_with]
41
+ vcr.insert_cassette(cassette_name, options)
42
+ [201, {'Content-Type' => 'application/json'}, [{'message': 'OK'}.to_json]]
43
+ rescue LoadError, ArgumentError => e
44
+ [501, {'Content-Type' => 'application/json'}, [{'message': e.message}.to_json]]
45
+ end
46
+
47
+ def handle_eject
48
+ logger.info "vcr eject cassette"
49
+ vcr.eject_cassette
50
+ do_first_call
51
+ [201, {'Content-Type' => 'application/json'}, [{'message': 'OK'}.to_json]]
52
+ rescue LoadError, ArgumentError => e
53
+ [501, {'Content-Type' => 'application/json'}, [{'message': e.message}.to_json]]
54
+ end
55
+
56
+ def vcr
57
+ return @vcr if @vcr
58
+ require 'vcr'
59
+ VCR.configure do |config|
60
+ config.cassette_library_dir = "#{configuration.cypress_folder}/fixtures/vcr_cassettes"
61
+ end
62
+ @vcr = VCR
63
+ end
64
+
65
+ def do_first_call
66
+ @first_call = true
67
+ vcr.turn_off!
68
+ WebMock.disable! if defined?(WebMock)
69
+ rescue LoadError
70
+ # nop
71
+ end
72
+ end
73
+ end
@@ -1,3 +1,3 @@
1
1
  module CypressOnRails
2
- VERSION = '1.12.1'.freeze
2
+ VERSION = '1.13.1'.freeze
3
3
  end
@@ -3,42 +3,36 @@ module CypressOnRails
3
3
  class_option :cypress_folder, type: :string, default: 'cypress'
4
4
  class_option :install_cypress, type: :boolean, default: true
5
5
  class_option :install_cypress_with, type: :string, default: 'yarn'
6
- class_option :install_cypress_examples, type: :boolean, default: false
6
+ class_option :experimental, type: :boolean, default: false
7
7
  source_root File.expand_path('../templates', __FILE__)
8
8
 
9
9
  def install_cypress
10
- if !Dir.exists?(options.cypress_folder) || Dir["#{options.cypress_folder}/*"].empty?
11
- directories = options.cypress_folder.split('/')
12
- directories.pop
13
- install_dir = "#{Dir.pwd}/#{directories.join('/')}"
14
- command = nil
15
- if options.install_cypress
16
- if options.install_cypress_with == 'yarn'
17
- command = "yarn --cwd=#{install_dir} add cypress --dev"
18
- elsif options.install_cypress_with == 'npm'
19
- command = "cd #{install_dir}; npm install cypress --save-dev"
20
- end
21
- if command
22
- say command
23
- fail 'failed to install cypress' unless system(command)
24
- end
10
+ directories = options.cypress_folder.split('/')
11
+ directories.pop
12
+ install_dir = "#{Dir.pwd}/#{directories.join('/')}"
13
+ command = nil
14
+ if options.install_cypress
15
+ if options.install_cypress_with == 'yarn'
16
+ command = "yarn --cwd=#{install_dir} add cypress --dev"
17
+ elsif options.install_cypress_with == 'npm'
18
+ command = "cd #{install_dir}; npm install cypress --save-dev"
25
19
  end
26
- if options.install_cypress_examples
27
- directory 'spec/cypress/integration/examples', "#{options.cypress_folder}/integration/examples"
28
- directory 'spec/cypress/fixtures', "#{options.cypress_folder}/fixtures"
20
+ if command
21
+ say command
22
+ fail 'failed to install cypress' unless system(command)
29
23
  end
30
- copy_file "spec/cypress/support/index.js", "#{options.cypress_folder}/support/index.js"
31
- copy_file "spec/cypress/support/commands.js", "#{options.cypress_folder}/support/commands.js"
32
- copy_file "spec/cypress.json", "#{options.cypress_folder}/../cypress.json"
33
24
  end
25
+ template "spec/cypress/support/index.js.erb", "#{options.cypress_folder}/support/index.js"
26
+ copy_file "spec/cypress/support/commands.js", "#{options.cypress_folder}/support/commands.js"
27
+ copy_file "spec/cypress.config.js", "#{options.cypress_folder}/../cypress.config.js"
34
28
  end
35
29
 
36
30
  def add_initial_files
37
31
  template "config/initializers/cypress_on_rails.rb.erb", "config/initializers/cypress_on_rails.rb"
38
- copy_file "spec/cypress/cypress_helper.rb", "#{options.cypress_folder}/cypress_helper.rb"
32
+ template "spec/cypress/cypress_helper.rb.erb", "#{options.cypress_folder}/cypress_helper.rb"
39
33
  copy_file "spec/cypress/support/on-rails.js", "#{options.cypress_folder}/support/on-rails.js"
40
34
  directory 'spec/cypress/app_commands', "#{options.cypress_folder}/app_commands"
41
- directory 'spec/cypress/integration/rails_examples', "#{options.cypress_folder}/integration/rails_examples"
35
+ directory 'spec/cypress/e2e/rails_examples', "#{options.cypress_folder}/e2e/rails_examples"
42
36
  end
43
37
 
44
38
  def update_files
@@ -4,6 +4,7 @@ if defined?(CypressOnRails)
4
4
  # WARNING!! CypressOnRails can execute arbitrary ruby code
5
5
  # please use with extra caution if enabling on hosted servers or starting your local server on 0.0.0.0
6
6
  c.use_middleware = !Rails.env.production?
7
+ <% unless options.experimental %># <% end %> c.use_vcr_middleware = !Rails.env.production?
7
8
  c.logger = Rails.logger
8
9
  end
9
10
 
@@ -9,4 +9,10 @@ end
9
9
 
10
10
  CypressOnRails::SmartFactoryWrapper.reload
11
11
 
12
+ if defined?(VCR)
13
+ VCR.eject_cassette # make sure we no cassette inserted before the next test starts
14
+ VCR.turn_off!
15
+ WebMock.disable! if defined?(WebMock)
16
+ end
17
+
12
18
  Rails.logger.info "APPCLEANED" # used by log_fail.rb
@@ -36,3 +36,8 @@ 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
@@ -0,0 +1,24 @@
1
+ describe('Rails Other examples', function() {
2
+ it('Inserting a cassette', function() {
3
+ cy.app('clean') // have a look at cypress/app_commands/clean.rb
4
+
5
+ cy.vcr_insert_cassette('cats', { record: "new_episodes" })
6
+ cy.visit('/using_vcr/index')
7
+
8
+ cy.get('a').contains('Cats').click()
9
+ cy.contains('Record from Cats API');
10
+
11
+ cy.vcr_eject_cassette();
12
+ })
13
+
14
+ it('Using previous a cassette', function() {
15
+ cy.app('clean') // have a look at cypress/app_commands/clean.rb
16
+
17
+ cy.vcr_insert_cassette('cats')
18
+ cy.visit('/using_vcr/index')
19
+ cy.get('a').contains('Cats').click()
20
+ cy.contains('Record from Cats API');
21
+
22
+ cy.vcr_eject_cassette();
23
+ })
24
+ })
@@ -14,6 +14,7 @@
14
14
  // ***********************************************************
15
15
 
16
16
  // Import commands.js using ES2015 syntax:
17
+ <% unless options.experimental %>// <% end %>import 'cypress-on-rails/support/index'
17
18
  import './commands'
18
19
  import './on-rails'
19
20
 
@@ -11,7 +11,7 @@ Cypress.Commands.add('appCommands', function (body) {
11
11
  }).then((response) => {
12
12
  log.end();
13
13
  if (response.status !== 201) {
14
- expect(response.body.message).to.be.empty
14
+ expect(response.body.message).to.equal('')
15
15
  expect(response.status).to.be.equal(201)
16
16
  }
17
17
  return response.body
@@ -0,0 +1,9 @@
1
+ const { defineConfig } = require('cypress')
2
+
3
+ module.exports = defineConfig({
4
+ e2e: {
5
+ baseUrl: "http://localhost:5017",
6
+ defaultCommandTimeout: 10000,
7
+ supportFile: "cypress/support/index.js",
8
+ }
9
+ })
data/plugin/.gitignore ADDED
@@ -0,0 +1 @@
1
+ node_modules
@@ -0,0 +1,4 @@
1
+ // export a function
2
+ module.exports = (on, config) => {
3
+ // configure plugins here
4
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "cypress-on-rails",
3
+ "version": "0.1.0",
4
+ "description": "Integrates cypress with rails or rack applications",
5
+ "main": "cypress/index.js",
6
+ "directories": {
7
+ "src": "cypress"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "build": "tsc"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/shakacode/cypress-on-rails.git"
16
+ },
17
+ "keywords": [
18
+ "cypress",
19
+ "ruby",
20
+ "rails"
21
+ ],
22
+ "author": "Grant Petersen-Speelman",
23
+ "license": "MIT",
24
+ "bugs": {
25
+ "url": "https://github.com/shakacode/cypress-on-rails/issues"
26
+ },
27
+ "homepage": "https://github.com/shakacode/cypress-on-rails#readme",
28
+ "dependencies": {
29
+ "cypress": "*"
30
+ }
31
+ }
@@ -0,0 +1,37 @@
1
+ Cypress.Commands.add("vcr_insert_cassette", (cassette_name, options) => {
2
+ if (!options) options = {};
3
+
4
+ Object.keys(options).forEach(key => options[key] === undefined ? delete options[key] : {});
5
+ const log = Cypress.log({ name: "VCR Insert", message: cassette_name, autoEnd: false })
6
+ return cy.request({
7
+ method: 'POST',
8
+ url: "/__cypress__/vcr/insert",
9
+ body: JSON.stringify([cassette_name,options]),
10
+ log: false,
11
+ failOnStatusCode: false
12
+ }).then((response) => {
13
+ log.end();
14
+ if (response.status !== 201) {
15
+ expect(response.body.message).to.equal('')
16
+ expect(response.status).to.be.equal(201)
17
+ }
18
+ return response.body
19
+ });
20
+ });
21
+
22
+ Cypress.Commands.add("vcr_eject_cassette", () => {
23
+ const log = Cypress.log({ name: "VCR Eject", autoEnd: false })
24
+ return cy.request({
25
+ method: 'POST',
26
+ url: "/__cypress__/vcr/eject",
27
+ log: false,
28
+ failOnStatusCode: false
29
+ }).then((response) => {
30
+ log.end();
31
+ if (response.status !== 201) {
32
+ expect(response.body.message).to.equal('')
33
+ expect(response.status).to.be.equal(201)
34
+ }
35
+ return response.body
36
+ });
37
+ });
@@ -93,7 +93,9 @@ RSpec.describe CypressOnRails::Middleware do
93
93
  allow(file).to receive(:exist?).with('spec/cypress/app_commands/load_sample.rb').and_return(false)
94
94
 
95
95
  aggregate_failures do
96
- expect(response).to eq([404, {}, ['could not find command file: spec/cypress/app_commands/load_sample.rb']])
96
+ expect(response).to eq([404,
97
+ {"Content-Type"=>"application/json"},
98
+ ["{\"message\":\"could not find command file: spec/cypress/app_commands/load_sample.rb\"}"]])
97
99
  expect(command_executor).to_not have_received(:perform)
98
100
  end
99
101
  end