cypress-on-rails 1.12.1 → 1.13.0

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 +7 -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/{integration/rails_examples/advance_factory_bot_spec.js → e2e/rails_examples/advance_factory_bot.cy.js} +0 -0
  19. data/lib/generators/cypress_on_rails/templates/spec/cypress/{integration/rails_examples/other_spec.js → e2e/rails_examples/other.cy.js} +0 -0
  20. 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
  21. 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
  22. 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
  23. data/lib/generators/cypress_on_rails/templates/spec/cypress/e2e/rails_examples/using_vcr.cy.js +24 -0
  24. data/lib/generators/cypress_on_rails/templates/spec/cypress/support/{index.js → index.js.erb} +1 -0
  25. data/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js +1 -1
  26. data/lib/generators/cypress_on_rails/templates/spec/cypress.config.js +9 -0
  27. data/plugin/.gitignore +1 -0
  28. data/plugin/cypress/plugins/index.js +4 -0
  29. data/plugin/package.json +31 -0
  30. data/plugin/support/index.js +37 -0
  31. data/spec/cypress_on_rails/middleware_spec.rb +3 -1
  32. data/spec/cypress_on_rails/vcr_middleware_spec.rb +119 -0
  33. data/specs_e2e/cypress.config.js +10 -0
  34. data/{spec/integrations → specs_e2e}/rails_3_2/.gitignore +1 -1
  35. data/specs_e2e/rails_3_2/.ruby_version +1 -0
  36. data/{spec/integrations → specs_e2e}/rails_3_2/Gemfile +1 -1
  37. data/{spec/integrations → specs_e2e}/rails_3_2/README.rdoc +0 -0
  38. data/{spec/integrations → specs_e2e}/rails_3_2/Rakefile +0 -0
  39. data/{spec/integrations → specs_e2e}/rails_3_2/app/assets/stylesheets/application.css +0 -0
  40. data/{spec/integrations → specs_e2e}/rails_3_2/app/controllers/application_controller.rb +0 -0
  41. data/{spec/integrations → specs_e2e}/rails_3_2/app/controllers/welcome_controller.rb +0 -0
  42. data/{spec/integrations → specs_e2e}/rails_3_2/app/helpers/application_helper.rb +0 -0
  43. data/{spec/integrations → specs_e2e}/rails_3_2/app/models/post.rb +0 -0
  44. data/{spec/integrations → specs_e2e}/rails_3_2/app/views/layouts/application.html.erb +0 -0
  45. data/{spec/integrations → specs_e2e}/rails_3_2/app/views/welcome/index.html.erb +0 -0
  46. data/{spec/integrations → specs_e2e}/rails_3_2/bin/rails +0 -0
  47. data/{spec/integrations → specs_e2e}/rails_3_2/config/application.rb +0 -0
  48. data/{spec/integrations → specs_e2e}/rails_3_2/config/boot.rb +0 -0
  49. data/{spec/integrations → specs_e2e}/rails_3_2/config/environment.rb +0 -0
  50. data/{spec/integrations → specs_e2e}/rails_3_2/config/environments/development.rb +0 -0
  51. data/{spec/integrations → specs_e2e}/rails_3_2/config/environments/production.rb +0 -0
  52. data/{spec/integrations → specs_e2e}/rails_3_2/config/environments/test.rb +0 -0
  53. data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/backtrace_silencers.rb +0 -0
  54. data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/inflections.rb +0 -0
  55. data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/mime_types.rb +0 -0
  56. data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/secret_token.rb +0 -0
  57. data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/session_store.rb +0 -0
  58. data/{spec/integrations → specs_e2e}/rails_3_2/config/initializers/wrap_parameters.rb +0 -0
  59. data/{spec/integrations → specs_e2e}/rails_3_2/config/locales/en.yml +0 -0
  60. data/{spec/integrations → specs_e2e}/rails_3_2/config/routes.rb +0 -0
  61. data/{spec/integrations → specs_e2e}/rails_3_2/config.ru +0 -0
  62. data/{spec/integrations → specs_e2e}/rails_3_2/log/.keep +0 -0
  63. data/{spec/integrations → specs_e2e}/rails_3_2/public/404.html +0 -0
  64. data/{spec/integrations → specs_e2e}/rails_3_2/public/422.html +0 -0
  65. data/{spec/integrations → specs_e2e}/rails_3_2/public/500.html +0 -0
  66. data/{spec/integrations → specs_e2e}/rails_3_2/public/favicon.ico +0 -0
  67. data/{spec/integrations → specs_e2e}/rails_3_2/public/robots.txt +0 -0
  68. data/{spec/integrations → specs_e2e}/rails_3_2/test.sh +8 -7
  69. data/{spec/integrations → specs_e2e}/rails_3_2/tmp/.keep +0 -0
  70. data/{spec/integrations → specs_e2e}/rails_3_2/vendor/.gitkeep +0 -0
  71. data/{spec/integrations → specs_e2e}/rails_4_2/.gitignore +3 -2
  72. data/{spec/integrations → specs_e2e}/rails_4_2/Gemfile +3 -1
  73. data/{spec/integrations → specs_e2e}/rails_4_2/README.rdoc +0 -0
  74. data/{spec/integrations → specs_e2e}/rails_4_2/Rakefile +0 -0
  75. data/{spec/integrations/rails_5_2/app/assets/javascripts/posts.js → specs_e2e/rails_4_2/app/assets/javascripts/using_vcr.js} +0 -0
  76. data/{spec/integrations/rails_5_2/app/assets/stylesheets/posts.css → specs_e2e/rails_4_2/app/assets/stylesheets/using_vcr.css} +0 -0
  77. data/{spec/integrations → specs_e2e}/rails_4_2/app/controllers/application_controller.rb +0 -0
  78. data/specs_e2e/rails_4_2/app/controllers/using_vcr_controller.rb +10 -0
  79. data/{spec/integrations → specs_e2e}/rails_4_2/app/controllers/welcome_controller.rb +0 -0
  80. data/{spec/integrations → specs_e2e}/rails_4_2/app/models/post.rb +3 -1
  81. data/{spec/integrations → specs_e2e}/rails_4_2/app/views/layouts/application.html.erb +0 -0
  82. data/specs_e2e/rails_4_2/app/views/using_vcr/index.html.erb +6 -0
  83. data/specs_e2e/rails_4_2/app/views/using_vcr/record_cats.html.erb +7 -0
  84. data/{spec/integrations → specs_e2e}/rails_4_2/app/views/welcome/index.html.erb +0 -0
  85. data/{spec/integrations → specs_e2e}/rails_4_2/bin/bundle +0 -0
  86. data/{spec/integrations → specs_e2e}/rails_4_2/bin/rails +0 -0
  87. data/{spec/integrations → specs_e2e}/rails_4_2/bin/rake +0 -0
  88. data/{spec/integrations → specs_e2e}/rails_4_2/bin/setup +0 -0
  89. data/{spec/integrations → specs_e2e}/rails_4_2/config/application.rb +0 -0
  90. data/{spec/integrations → specs_e2e}/rails_4_2/config/boot.rb +0 -0
  91. data/{spec/integrations → specs_e2e}/rails_4_2/config/environment.rb +0 -0
  92. data/{spec/integrations → specs_e2e}/rails_4_2/config/environments/development.rb +0 -0
  93. data/{spec/integrations → specs_e2e}/rails_4_2/config/environments/production.rb +0 -0
  94. data/{spec/integrations → specs_e2e}/rails_4_2/config/environments/test.rb +0 -0
  95. data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/backtrace_silencers.rb +0 -0
  96. data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/cookies_serializer.rb +0 -0
  97. data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/filter_parameter_logging.rb +0 -0
  98. data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/inflections.rb +0 -0
  99. data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/mime_types.rb +0 -0
  100. data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/session_store.rb +0 -0
  101. data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/to_time_preserves_timezone.rb +0 -0
  102. data/{spec/integrations → specs_e2e}/rails_4_2/config/initializers/wrap_parameters.rb +0 -0
  103. data/{spec/integrations → specs_e2e}/rails_4_2/config/locales/en.yml +0 -0
  104. data/{spec/integrations → specs_e2e}/rails_4_2/config/routes.rb +5 -0
  105. data/{spec/integrations → specs_e2e}/rails_4_2/config/secrets.yml +0 -0
  106. data/{spec/integrations → specs_e2e}/rails_4_2/config.ru +0 -0
  107. data/specs_e2e/rails_4_2/package.json +10 -0
  108. data/{spec/integrations → specs_e2e}/rails_4_2/public/404.html +0 -0
  109. data/{spec/integrations → specs_e2e}/rails_4_2/public/422.html +0 -0
  110. data/{spec/integrations → specs_e2e}/rails_4_2/public/500.html +0 -0
  111. data/{spec/integrations → specs_e2e}/rails_4_2/public/favicon.ico +0 -0
  112. data/{spec/integrations → specs_e2e}/rails_4_2/public/robots.txt +0 -0
  113. data/{spec/integrations/rails_4_2/log → specs_e2e/rails_4_2/spec}/.keep +0 -0
  114. data/{spec/integrations → specs_e2e}/rails_4_2/test.sh +13 -12
  115. data/{spec/integrations/rails_4_2/spec → specs_e2e/rails_4_2/vendor}/.keep +0 -0
  116. data/{spec/integrations → specs_e2e}/rails_5_2/.gitignore +1 -1
  117. data/{spec/integrations → specs_e2e}/rails_5_2/Gemfile +1 -1
  118. data/{spec/integrations → specs_e2e}/rails_5_2/README.md +0 -0
  119. data/{spec/integrations → specs_e2e}/rails_5_2/Rakefile +0 -0
  120. data/specs_e2e/rails_5_2/app/assets/javascripts/posts.js +2 -0
  121. data/specs_e2e/rails_5_2/app/assets/stylesheets/posts.css +4 -0
  122. data/{spec/integrations → specs_e2e}/rails_5_2/app/assets/stylesheets/scaffold.css +0 -0
  123. data/{spec/integrations → specs_e2e}/rails_5_2/app/controllers/application_controller.rb +0 -0
  124. data/{spec/integrations → specs_e2e}/rails_5_2/app/controllers/posts_controller.rb +0 -0
  125. data/{spec/integrations → specs_e2e}/rails_5_2/app/helpers/posts_helper.rb +0 -0
  126. data/{spec/integrations → specs_e2e}/rails_5_2/app/jobs/application_job.rb +0 -0
  127. data/{spec/integrations → specs_e2e}/rails_5_2/app/models/application_record.rb +0 -0
  128. data/{spec/integrations → specs_e2e}/rails_5_2/app/models/post.rb +0 -0
  129. data/{spec/integrations → specs_e2e}/rails_5_2/app/views/layouts/application.html.erb +0 -0
  130. data/{spec/integrations → specs_e2e}/rails_5_2/app/views/posts/_form.html.erb +0 -0
  131. data/{spec/integrations → specs_e2e}/rails_5_2/app/views/posts/edit.html.erb +0 -0
  132. data/{spec/integrations → specs_e2e}/rails_5_2/app/views/posts/index.html.erb +0 -0
  133. data/{spec/integrations → specs_e2e}/rails_5_2/app/views/posts/new.html.erb +0 -0
  134. data/{spec/integrations → specs_e2e}/rails_5_2/app/views/posts/show.html.erb +0 -0
  135. data/{spec/integrations → specs_e2e}/rails_5_2/app/views/welcome/index.html.erb +0 -0
  136. data/{spec/integrations → specs_e2e}/rails_5_2/bin/bundle +0 -0
  137. data/{spec/integrations → specs_e2e}/rails_5_2/bin/rails +0 -0
  138. data/{spec/integrations → specs_e2e}/rails_5_2/bin/rake +0 -0
  139. data/{spec/integrations → specs_e2e}/rails_5_2/bin/setup +0 -0
  140. data/{spec/integrations → specs_e2e}/rails_5_2/bin/update +0 -0
  141. data/{spec/integrations → specs_e2e}/rails_5_2/config/application.rb +0 -0
  142. data/{spec/integrations → specs_e2e}/rails_5_2/config/boot.rb +0 -0
  143. data/{spec/integrations → specs_e2e}/rails_5_2/config/credentials.yml.enc +0 -0
  144. data/{spec/integrations → specs_e2e}/rails_5_2/config/database.yml +0 -0
  145. data/{spec/integrations → specs_e2e}/rails_5_2/config/environment.rb +0 -0
  146. data/{spec/integrations → specs_e2e}/rails_5_2/config/environments/development.rb +0 -0
  147. data/{spec/integrations → specs_e2e}/rails_5_2/config/environments/production.rb +0 -0
  148. data/{spec/integrations → specs_e2e}/rails_5_2/config/environments/test.rb +0 -0
  149. data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/application_controller_renderer.rb +0 -0
  150. data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/backtrace_silencers.rb +0 -0
  151. data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/content_security_policy.rb +0 -0
  152. data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/cookies_serializer.rb +0 -0
  153. data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/filter_parameter_logging.rb +0 -0
  154. data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/inflections.rb +0 -0
  155. data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/mime_types.rb +0 -0
  156. data/{spec/integrations → specs_e2e}/rails_5_2/config/initializers/wrap_parameters.rb +0 -0
  157. data/{spec/integrations → specs_e2e}/rails_5_2/config/locales/en.yml +0 -0
  158. data/{spec/integrations → specs_e2e}/rails_5_2/config/master.key +0 -0
  159. data/{spec/integrations → specs_e2e}/rails_5_2/config/routes.rb +0 -0
  160. data/{spec/integrations → specs_e2e}/rails_5_2/config.ru +0 -0
  161. data/{spec/integrations → specs_e2e}/rails_5_2/db/migrate/20180621085832_create_posts.rb +0 -0
  162. data/{spec/integrations → specs_e2e}/rails_5_2/public/404.html +0 -0
  163. data/{spec/integrations → specs_e2e}/rails_5_2/public/422.html +0 -0
  164. data/{spec/integrations → specs_e2e}/rails_5_2/public/500.html +0 -0
  165. data/{spec/integrations → specs_e2e}/rails_5_2/public/apple-touch-icon-precomposed.png +0 -0
  166. data/{spec/integrations → specs_e2e}/rails_5_2/public/apple-touch-icon.png +0 -0
  167. data/{spec/integrations → specs_e2e}/rails_5_2/public/favicon.ico +0 -0
  168. data/{spec/integrations → specs_e2e}/rails_5_2/public/robots.txt +0 -0
  169. data/{spec/integrations → specs_e2e}/rails_5_2/test/controllers/posts_controller_test.rb +0 -0
  170. data/{spec/integrations → specs_e2e}/rails_5_2/test/cypress_fixtures/posts.yml +0 -0
  171. data/{spec/integrations → specs_e2e}/rails_5_2/test/fixtures/posts.yml +0 -0
  172. data/{spec/integrations → specs_e2e}/rails_5_2/test/models/post_test.rb +0 -0
  173. data/{spec/integrations → specs_e2e}/rails_5_2/test.sh +8 -7
  174. data/{spec/integrations/rails_4_2 → specs_e2e/rails_5_2}/vendor/.keep +0 -0
  175. metadata +177 -171
  176. data/lib/generators/cypress_on_rails/templates/spec/cypress/fixtures/example.json +0 -5
  177. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/actions.spec.js +0 -272
  178. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/aliasing.spec.js +0 -42
  179. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/assertions.spec.js +0 -63
  180. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/connectors.spec.js +0 -55
  181. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cookies.spec.js +0 -78
  182. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cypress_api.spec.js +0 -211
  183. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/files.spec.js +0 -86
  184. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/local_storage.spec.js +0 -52
  185. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/location.spec.js +0 -32
  186. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js +0 -68
  187. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/navigation.spec.js +0 -54
  188. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/network_requests.spec.js +0 -108
  189. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/querying.spec.js +0 -65
  190. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/spies_stubs_clocks.spec.js +0 -62
  191. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/traversal.spec.js +0 -121
  192. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/utilities.spec.js +0 -89
  193. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/viewport.spec.js +0 -59
  194. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/waiting.spec.js +0 -34
  195. data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/window.spec.js +0 -22
  196. data/lib/generators/cypress_on_rails/templates/spec/cypress.json +0 -4
  197. data/spec/integrations/cypress.json +0 -5
  198. data/spec/integrations/rails_5_2/log/.keep +0 -0
  199. data/spec/integrations/rails_5_2/tmp/.keep +0 -0
  200. data/spec/integrations/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: 4e692aca2d9231cc396238b157013e6208ab5522dcfc9de9a6db13eab6f2e432
4
+ data.tar.gz: 9e131491dc1bbbdefeead03eda472b20bc2e2b9fb4c92e55a76fdda3cbb547a0
5
5
  SHA512:
6
- metadata.gz: 4022aeb303bf3fa6514cd2b221869bb531e7e0be1b85de8f35ba20f6e5d2ff9fc8062ab2560a7d71d17ce0931719c3e57a33b23b25e3fa3ddb60a02de579c527
7
- data.tar.gz: 18d9b6423eb5fafbf2bf756de4b9e72fc8a5dc8b0240a15a1598e97f16acac6e589ff591493158ced0779374a27a347525c75eb4b4d1b9b2dd16364276afd10d
6
+ metadata.gz: cb3f7b9e0496cd4033bd97b7c5c218f28af991fae0ab42e4fec7b23fad7a71103ea3a33cd0cf8c17c16095f7eacc0aca296b547bc559b8a833a688a62d9be88a
7
+ data.tar.gz: 6cf57ee05e4b8f04000671969af5bf96c337ae2d69ff9df8cfaf1d99efac4d28f3f38cce1f7bf518db491b7a88a10265b82b1d8e0f96033de509f060d1e20b88
@@ -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,10 @@
1
+ ## [1.13.0]
2
+ [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.12.1...v1.13.0
3
+
4
+ ### Changed
5
+ * Add support for matching npm package and VCR
6
+ * generate for cypress 10 [PR 108](https://github.com/shakacode/cypress-on-rails/pull/108)
7
+
1
8
  ## [1.12.1]
2
9
  [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.12.0...v1.12.1
3
10
 
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 = true
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.0'.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
+ });