appmap 0.83.2 → 0.83.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (362) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +16 -0
  3. data/CHANGELOG.md +21 -0
  4. data/appmap.gemspec +2 -1
  5. data/lib/appmap/hook/method/ruby2.rb +7 -3
  6. data/lib/appmap/hook/method/ruby3.rb +7 -3
  7. data/lib/appmap/version.rb +1 -1
  8. metadata +3 -356
  9. data/spec/class_map_spec.rb +0 -28
  10. data/spec/config_spec.rb +0 -155
  11. data/spec/depends/api_spec.rb +0 -196
  12. data/spec/depends/spec_helper.rb +0 -18
  13. data/spec/display_string_spec.rb +0 -40
  14. data/spec/fixtures/config/incomplete_config.yml +0 -1
  15. data/spec/fixtures/config/invalid_config.yml +0 -2
  16. data/spec/fixtures/config/invalid_yaml_config.yml +0 -3
  17. data/spec/fixtures/config/maximal_config.yml +0 -14
  18. data/spec/fixtures/config/missing_path_or_gem.yml +0 -3
  19. data/spec/fixtures/config/valid_config.yml +0 -3
  20. data/spec/fixtures/database.yml +0 -11
  21. data/spec/fixtures/depends/.gitignore +0 -2
  22. data/spec/fixtures/depends/app/controllers/api/api_keys_controller.rb +0 -2
  23. data/spec/fixtures/depends/app/controllers/organizations_controller.rb +0 -2
  24. data/spec/fixtures/depends/app/models/api_key.rb +0 -2
  25. data/spec/fixtures/depends/app/models/configuration.rb +0 -2
  26. data/spec/fixtures/depends/app/models/show.rb +0 -2
  27. data/spec/fixtures/depends/app/models/user.rb +0 -2
  28. data/spec/fixtures/depends/revoke_api_key.appmap.json +0 -901
  29. data/spec/fixtures/depends/spec/actual_rspec_test.rb +0 -7
  30. data/spec/fixtures/depends/spec/api_spec.rb +0 -2
  31. data/spec/fixtures/depends/spec/user_spec.rb +0 -2
  32. data/spec/fixtures/depends/test/actual_minitest_test.rb +0 -5
  33. data/spec/fixtures/depends/user_page_scenario.appmap.json +0 -1776
  34. data/spec/fixtures/hook/.gitignore +0 -2
  35. data/spec/fixtures/hook/app/controllers/api/api_keys_controller.rb +0 -1
  36. data/spec/fixtures/hook/app/controllers/organizations_controller.rb +0 -1
  37. data/spec/fixtures/hook/app/models/api_key.rb +0 -1
  38. data/spec/fixtures/hook/app/models/configuration.rb +0 -1
  39. data/spec/fixtures/hook/app/models/show.rb +0 -1
  40. data/spec/fixtures/hook/app/models/user.rb +0 -1
  41. data/spec/fixtures/hook/attr_accessor.rb +0 -5
  42. data/spec/fixtures/hook/compare.rb +0 -7
  43. data/spec/fixtures/hook/constructor.rb +0 -7
  44. data/spec/fixtures/hook/custom_instance_method.rb +0 -11
  45. data/spec/fixtures/hook/exception_method.rb +0 -61
  46. data/spec/fixtures/hook/exclude.rb +0 -15
  47. data/spec/fixtures/hook/instance_method.rb +0 -31
  48. data/spec/fixtures/hook/kwargs.rb +0 -11
  49. data/spec/fixtures/hook/labels.rb +0 -6
  50. data/spec/fixtures/hook/method_named_call.rb +0 -11
  51. data/spec/fixtures/hook/pkg_a/a.rb +0 -7
  52. data/spec/fixtures/hook/prepended_override.rb +0 -14
  53. data/spec/fixtures/hook/protected_method.rb +0 -29
  54. data/spec/fixtures/hook/report_parameters.rb +0 -8
  55. data/spec/fixtures/hook/revoke_api_key.appmap.json +0 -847
  56. data/spec/fixtures/hook/singleton_method.rb +0 -63
  57. data/spec/fixtures/hook/spec/api_spec.rb +0 -1
  58. data/spec/fixtures/hook/spec/user_spec.rb +0 -1
  59. data/spec/fixtures/hook/sub_packages.rb +0 -7
  60. data/spec/fixtures/hook/user_page_scenario.appmap.json +0 -1722
  61. data/spec/fixtures/rack_users_app/.dockerignore +0 -2
  62. data/spec/fixtures/rack_users_app/.gitignore +0 -2
  63. data/spec/fixtures/rack_users_app/Gemfile +0 -10
  64. data/spec/fixtures/rack_users_app/appmap.yml +0 -3
  65. data/spec/fixtures/rack_users_app/config.ru +0 -2
  66. data/spec/fixtures/rack_users_app/lib/app.rb +0 -36
  67. data/spec/fixtures/rails5_users_app/.dockerignore +0 -1
  68. data/spec/fixtures/rails5_users_app/.gitignore +0 -39
  69. data/spec/fixtures/rails5_users_app/.rspec +0 -1
  70. data/spec/fixtures/rails5_users_app/.ruby-version +0 -1
  71. data/spec/fixtures/rails5_users_app/Gemfile +0 -54
  72. data/spec/fixtures/rails5_users_app/Rakefile +0 -6
  73. data/spec/fixtures/rails5_users_app/app/controllers/api/users_controller.rb +0 -29
  74. data/spec/fixtures/rails5_users_app/app/controllers/application_controller.rb +0 -2
  75. data/spec/fixtures/rails5_users_app/app/controllers/concerns/.keep +0 -0
  76. data/spec/fixtures/rails5_users_app/app/controllers/health_controller.rb +0 -5
  77. data/spec/fixtures/rails5_users_app/app/controllers/users_controller.rb +0 -21
  78. data/spec/fixtures/rails5_users_app/app/models/activerecord/user.rb +0 -18
  79. data/spec/fixtures/rails5_users_app/app/models/concerns/.keep +0 -0
  80. data/spec/fixtures/rails5_users_app/app/models/sequel/user.rb +0 -25
  81. data/spec/fixtures/rails5_users_app/app/views/layouts/application.html.haml +0 -7
  82. data/spec/fixtures/rails5_users_app/app/views/users/index.html.haml +0 -7
  83. data/spec/fixtures/rails5_users_app/appmap.yml +0 -11
  84. data/spec/fixtures/rails5_users_app/bin/appmap +0 -29
  85. data/spec/fixtures/rails5_users_app/bin/byebug +0 -29
  86. data/spec/fixtures/rails5_users_app/bin/gli +0 -29
  87. data/spec/fixtures/rails5_users_app/bin/htmldiff +0 -29
  88. data/spec/fixtures/rails5_users_app/bin/ldiff +0 -29
  89. data/spec/fixtures/rails5_users_app/bin/nokogiri +0 -29
  90. data/spec/fixtures/rails5_users_app/bin/rackup +0 -29
  91. data/spec/fixtures/rails5_users_app/bin/rails +0 -4
  92. data/spec/fixtures/rails5_users_app/bin/rake +0 -29
  93. data/spec/fixtures/rails5_users_app/bin/rspec +0 -29
  94. data/spec/fixtures/rails5_users_app/bin/ruby-parse +0 -29
  95. data/spec/fixtures/rails5_users_app/bin/ruby-rewrite +0 -29
  96. data/spec/fixtures/rails5_users_app/bin/sequel +0 -29
  97. data/spec/fixtures/rails5_users_app/bin/setup +0 -25
  98. data/spec/fixtures/rails5_users_app/bin/sprockets +0 -29
  99. data/spec/fixtures/rails5_users_app/bin/thor +0 -29
  100. data/spec/fixtures/rails5_users_app/bin/update +0 -25
  101. data/spec/fixtures/rails5_users_app/config/application.rb +0 -45
  102. data/spec/fixtures/rails5_users_app/config/boot.rb +0 -3
  103. data/spec/fixtures/rails5_users_app/config/credentials.yml.enc +0 -1
  104. data/spec/fixtures/rails5_users_app/config/database.yml +0 -1
  105. data/spec/fixtures/rails5_users_app/config/environment.rb +0 -5
  106. data/spec/fixtures/rails5_users_app/config/environments/development.rb +0 -40
  107. data/spec/fixtures/rails5_users_app/config/environments/production.rb +0 -68
  108. data/spec/fixtures/rails5_users_app/config/environments/test.rb +0 -39
  109. data/spec/fixtures/rails5_users_app/config/initializers/application_controller_renderer.rb +0 -8
  110. data/spec/fixtures/rails5_users_app/config/initializers/backtrace_silencers.rb +0 -7
  111. data/spec/fixtures/rails5_users_app/config/initializers/cors.rb +0 -16
  112. data/spec/fixtures/rails5_users_app/config/initializers/filter_parameter_logging.rb +0 -4
  113. data/spec/fixtures/rails5_users_app/config/initializers/inflections.rb +0 -16
  114. data/spec/fixtures/rails5_users_app/config/initializers/mime_types.rb +0 -4
  115. data/spec/fixtures/rails5_users_app/config/initializers/wrap_parameters.rb +0 -9
  116. data/spec/fixtures/rails5_users_app/config/locales/en.yml +0 -33
  117. data/spec/fixtures/rails5_users_app/config/routes.rb +0 -11
  118. data/spec/fixtures/rails5_users_app/config.ru +0 -5
  119. data/spec/fixtures/rails5_users_app/db/migrate/20190728211408_create_users.rb +0 -9
  120. data/spec/fixtures/rails5_users_app/db/schema.rb +0 -23
  121. data/spec/fixtures/rails5_users_app/features/api_users.feature +0 -13
  122. data/spec/fixtures/rails5_users_app/features/support/env.rb +0 -4
  123. data/spec/fixtures/rails5_users_app/features/support/hooks.rb +0 -11
  124. data/spec/fixtures/rails5_users_app/features/support/steps.rb +0 -18
  125. data/spec/fixtures/rails5_users_app/lib/tasks/.keep +0 -0
  126. data/spec/fixtures/rails5_users_app/log/.keep +0 -0
  127. data/spec/fixtures/rails5_users_app/public/robots.txt +0 -1
  128. data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_api_spec.rb +0 -42
  129. data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_spec.rb +0 -27
  130. data/spec/fixtures/rails5_users_app/spec/models/user_spec.rb +0 -29
  131. data/spec/fixtures/rails5_users_app/spec/rails_helper.rb +0 -57
  132. data/spec/fixtures/rails5_users_app/spec/spec_helper.rb +0 -96
  133. data/spec/fixtures/rails5_users_app/users_app/.gitignore +0 -20
  134. data/spec/fixtures/rails6_users_app/.dockerignore +0 -1
  135. data/spec/fixtures/rails6_users_app/.gitignore +0 -39
  136. data/spec/fixtures/rails6_users_app/.rspec +0 -1
  137. data/spec/fixtures/rails6_users_app/Gemfile +0 -28
  138. data/spec/fixtures/rails6_users_app/Rakefile +0 -6
  139. data/spec/fixtures/rails6_users_app/app/controllers/api/users_controller.rb +0 -28
  140. data/spec/fixtures/rails6_users_app/app/controllers/application_controller.rb +0 -2
  141. data/spec/fixtures/rails6_users_app/app/controllers/concerns/.keep +0 -0
  142. data/spec/fixtures/rails6_users_app/app/controllers/health_controller.rb +0 -5
  143. data/spec/fixtures/rails6_users_app/app/controllers/users_controller.rb +0 -21
  144. data/spec/fixtures/rails6_users_app/app/models/activerecord/user.rb +0 -18
  145. data/spec/fixtures/rails6_users_app/app/models/concerns/.keep +0 -0
  146. data/spec/fixtures/rails6_users_app/app/models/sequel/user.rb +0 -25
  147. data/spec/fixtures/rails6_users_app/app/views/layouts/application.html.haml +0 -7
  148. data/spec/fixtures/rails6_users_app/app/views/users/index.html.haml +0 -7
  149. data/spec/fixtures/rails6_users_app/appmap.yml +0 -14
  150. data/spec/fixtures/rails6_users_app/bin/appmap +0 -29
  151. data/spec/fixtures/rails6_users_app/bin/byebug +0 -29
  152. data/spec/fixtures/rails6_users_app/bin/gli +0 -29
  153. data/spec/fixtures/rails6_users_app/bin/htmldiff +0 -29
  154. data/spec/fixtures/rails6_users_app/bin/ldiff +0 -29
  155. data/spec/fixtures/rails6_users_app/bin/nokogiri +0 -29
  156. data/spec/fixtures/rails6_users_app/bin/rackup +0 -29
  157. data/spec/fixtures/rails6_users_app/bin/rails +0 -4
  158. data/spec/fixtures/rails6_users_app/bin/rake +0 -29
  159. data/spec/fixtures/rails6_users_app/bin/rspec +0 -29
  160. data/spec/fixtures/rails6_users_app/bin/ruby-parse +0 -29
  161. data/spec/fixtures/rails6_users_app/bin/ruby-rewrite +0 -29
  162. data/spec/fixtures/rails6_users_app/bin/sequel +0 -29
  163. data/spec/fixtures/rails6_users_app/bin/setup +0 -25
  164. data/spec/fixtures/rails6_users_app/bin/sprockets +0 -29
  165. data/spec/fixtures/rails6_users_app/bin/thor +0 -29
  166. data/spec/fixtures/rails6_users_app/bin/update +0 -25
  167. data/spec/fixtures/rails6_users_app/config/application.rb +0 -45
  168. data/spec/fixtures/rails6_users_app/config/boot.rb +0 -3
  169. data/spec/fixtures/rails6_users_app/config/credentials.yml.enc +0 -1
  170. data/spec/fixtures/rails6_users_app/config/database.yml +0 -1
  171. data/spec/fixtures/rails6_users_app/config/environment.rb +0 -5
  172. data/spec/fixtures/rails6_users_app/config/environments/development.rb +0 -40
  173. data/spec/fixtures/rails6_users_app/config/environments/production.rb +0 -68
  174. data/spec/fixtures/rails6_users_app/config/environments/test.rb +0 -39
  175. data/spec/fixtures/rails6_users_app/config/initializers/application_controller_renderer.rb +0 -8
  176. data/spec/fixtures/rails6_users_app/config/initializers/backtrace_silencers.rb +0 -7
  177. data/spec/fixtures/rails6_users_app/config/initializers/cors.rb +0 -16
  178. data/spec/fixtures/rails6_users_app/config/initializers/filter_parameter_logging.rb +0 -4
  179. data/spec/fixtures/rails6_users_app/config/initializers/inflections.rb +0 -16
  180. data/spec/fixtures/rails6_users_app/config/initializers/mime_types.rb +0 -4
  181. data/spec/fixtures/rails6_users_app/config/initializers/wrap_parameters.rb +0 -9
  182. data/spec/fixtures/rails6_users_app/config/locales/en.yml +0 -33
  183. data/spec/fixtures/rails6_users_app/config/routes.rb +0 -11
  184. data/spec/fixtures/rails6_users_app/config.ru +0 -5
  185. data/spec/fixtures/rails6_users_app/db/migrate/20190728211408_create_users.rb +0 -9
  186. data/spec/fixtures/rails6_users_app/db/schema.rb +0 -23
  187. data/spec/fixtures/rails6_users_app/features/api_users.feature +0 -13
  188. data/spec/fixtures/rails6_users_app/features/support/env.rb +0 -4
  189. data/spec/fixtures/rails6_users_app/features/support/hooks.rb +0 -11
  190. data/spec/fixtures/rails6_users_app/features/support/steps.rb +0 -18
  191. data/spec/fixtures/rails6_users_app/lib/tasks/.keep +0 -0
  192. data/spec/fixtures/rails6_users_app/lib/tasks/appmap.rake +0 -23
  193. data/spec/fixtures/rails6_users_app/log/.keep +0 -0
  194. data/spec/fixtures/rails6_users_app/package.json +0 -8
  195. data/spec/fixtures/rails6_users_app/public/robots.txt +0 -1
  196. data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb +0 -42
  197. data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_spec.rb +0 -27
  198. data/spec/fixtures/rails6_users_app/spec/models/user_spec.rb +0 -29
  199. data/spec/fixtures/rails6_users_app/spec/rails_helper.rb +0 -57
  200. data/spec/fixtures/rails6_users_app/spec/spec_helper.rb +0 -96
  201. data/spec/fixtures/rails6_users_app/test/controllers/functional_calc_test.rb +0 -10
  202. data/spec/fixtures/rails6_users_app/test/integration/integration_calc_test.rb +0 -12
  203. data/spec/fixtures/rails6_users_app/users_app/.gitignore +0 -20
  204. data/spec/fixtures/rails6_users_app/yarn.lock +0 -2020
  205. data/spec/fixtures/rails7_users_app/.dockerignore +0 -1
  206. data/spec/fixtures/rails7_users_app/.gitattributes +0 -7
  207. data/spec/fixtures/rails7_users_app/.gitignore +0 -31
  208. data/spec/fixtures/rails7_users_app/.rspec +0 -1
  209. data/spec/fixtures/rails7_users_app/Gemfile +0 -75
  210. data/spec/fixtures/rails7_users_app/README.md +0 -24
  211. data/spec/fixtures/rails7_users_app/Rakefile +0 -6
  212. data/spec/fixtures/rails7_users_app/app/assets/config/manifest.js +0 -4
  213. data/spec/fixtures/rails7_users_app/app/assets/images/.keep +0 -0
  214. data/spec/fixtures/rails7_users_app/app/assets/stylesheets/application.css +0 -15
  215. data/spec/fixtures/rails7_users_app/app/channels/application_cable/channel.rb +0 -4
  216. data/spec/fixtures/rails7_users_app/app/channels/application_cable/connection.rb +0 -4
  217. data/spec/fixtures/rails7_users_app/app/controllers/application_controller.rb +0 -2
  218. data/spec/fixtures/rails7_users_app/app/controllers/concerns/.keep +0 -0
  219. data/spec/fixtures/rails7_users_app/app/helpers/application_helper.rb +0 -2
  220. data/spec/fixtures/rails7_users_app/app/javascript/application.js +0 -3
  221. data/spec/fixtures/rails7_users_app/app/javascript/controllers/application.js +0 -9
  222. data/spec/fixtures/rails7_users_app/app/javascript/controllers/hello_controller.js +0 -7
  223. data/spec/fixtures/rails7_users_app/app/javascript/controllers/index.js +0 -11
  224. data/spec/fixtures/rails7_users_app/app/jobs/application_job.rb +0 -7
  225. data/spec/fixtures/rails7_users_app/app/mailers/application_mailer.rb +0 -4
  226. data/spec/fixtures/rails7_users_app/app/models/application_record.rb +0 -3
  227. data/spec/fixtures/rails7_users_app/app/models/concerns/.keep +0 -0
  228. data/spec/fixtures/rails7_users_app/app/models/instance.rb +0 -7
  229. data/spec/fixtures/rails7_users_app/app/models/instructor.rb +0 -7
  230. data/spec/fixtures/rails7_users_app/app/views/layouts/application.html.erb +0 -16
  231. data/spec/fixtures/rails7_users_app/app/views/layouts/mailer.html.erb +0 -13
  232. data/spec/fixtures/rails7_users_app/app/views/layouts/mailer.text.erb +0 -1
  233. data/spec/fixtures/rails7_users_app/appmap.yml +0 -3
  234. data/spec/fixtures/rails7_users_app/bin/bundle +0 -114
  235. data/spec/fixtures/rails7_users_app/bin/importmap +0 -4
  236. data/spec/fixtures/rails7_users_app/bin/rails +0 -4
  237. data/spec/fixtures/rails7_users_app/bin/rake +0 -4
  238. data/spec/fixtures/rails7_users_app/bin/setup +0 -33
  239. data/spec/fixtures/rails7_users_app/config/application.rb +0 -22
  240. data/spec/fixtures/rails7_users_app/config/boot.rb +0 -4
  241. data/spec/fixtures/rails7_users_app/config/cable.yml +0 -10
  242. data/spec/fixtures/rails7_users_app/config/credentials.yml.enc +0 -1
  243. data/spec/fixtures/rails7_users_app/config/database.yml +0 -1
  244. data/spec/fixtures/rails7_users_app/config/environment.rb +0 -5
  245. data/spec/fixtures/rails7_users_app/config/environments/development.rb +0 -70
  246. data/spec/fixtures/rails7_users_app/config/environments/production.rb +0 -93
  247. data/spec/fixtures/rails7_users_app/config/environments/test.rb +0 -60
  248. data/spec/fixtures/rails7_users_app/config/importmap.rb +0 -7
  249. data/spec/fixtures/rails7_users_app/config/initializers/assets.rb +0 -12
  250. data/spec/fixtures/rails7_users_app/config/initializers/content_security_policy.rb +0 -26
  251. data/spec/fixtures/rails7_users_app/config/initializers/filter_parameter_logging.rb +0 -8
  252. data/spec/fixtures/rails7_users_app/config/initializers/inflections.rb +0 -16
  253. data/spec/fixtures/rails7_users_app/config/initializers/permissions_policy.rb +0 -11
  254. data/spec/fixtures/rails7_users_app/config/locales/en.yml +0 -33
  255. data/spec/fixtures/rails7_users_app/config/puma.rb +0 -43
  256. data/spec/fixtures/rails7_users_app/config/routes.rb +0 -6
  257. data/spec/fixtures/rails7_users_app/config/storage.yml +0 -34
  258. data/spec/fixtures/rails7_users_app/config.ru +0 -6
  259. data/spec/fixtures/rails7_users_app/db/migrate/20220328093141_create_instances.rb +0 -8
  260. data/spec/fixtures/rails7_users_app/db/migrate/20220328093154_create_instructors.rb +0 -8
  261. data/spec/fixtures/rails7_users_app/db/schema.rb +0 -27
  262. data/spec/fixtures/rails7_users_app/db/seeds.rb +0 -7
  263. data/spec/fixtures/rails7_users_app/lib/assets/.keep +0 -0
  264. data/spec/fixtures/rails7_users_app/lib/tasks/.keep +0 -0
  265. data/spec/fixtures/rails7_users_app/log/.keep +0 -0
  266. data/spec/fixtures/rails7_users_app/public/404.html +0 -67
  267. data/spec/fixtures/rails7_users_app/public/422.html +0 -67
  268. data/spec/fixtures/rails7_users_app/public/500.html +0 -66
  269. data/spec/fixtures/rails7_users_app/public/apple-touch-icon-precomposed.png +0 -0
  270. data/spec/fixtures/rails7_users_app/public/apple-touch-icon.png +0 -0
  271. data/spec/fixtures/rails7_users_app/public/favicon.ico +0 -0
  272. data/spec/fixtures/rails7_users_app/public/robots.txt +0 -1
  273. data/spec/fixtures/rails7_users_app/storage/.keep +0 -0
  274. data/spec/fixtures/rails7_users_app/test/application_system_test_case.rb +0 -5
  275. data/spec/fixtures/rails7_users_app/test/channels/application_cable/connection_test.rb +0 -11
  276. data/spec/fixtures/rails7_users_app/test/controllers/.keep +0 -0
  277. data/spec/fixtures/rails7_users_app/test/fixtures/files/.keep +0 -0
  278. data/spec/fixtures/rails7_users_app/test/fixtures/instances.yml +0 -11
  279. data/spec/fixtures/rails7_users_app/test/fixtures/instructors.yml +0 -11
  280. data/spec/fixtures/rails7_users_app/test/helpers/.keep +0 -0
  281. data/spec/fixtures/rails7_users_app/test/integration/.keep +0 -0
  282. data/spec/fixtures/rails7_users_app/test/mailers/.keep +0 -0
  283. data/spec/fixtures/rails7_users_app/test/models/.keep +0 -0
  284. data/spec/fixtures/rails7_users_app/test/models/instance_test.rb +0 -6
  285. data/spec/fixtures/rails7_users_app/test/models/instructor_test.rb +0 -7
  286. data/spec/fixtures/rails7_users_app/test/system/.keep +0 -0
  287. data/spec/fixtures/rails7_users_app/test/test_helper.rb +0 -13
  288. data/spec/handler/eval_spec.rb +0 -66
  289. data/spec/hook_spec.rb +0 -1216
  290. data/spec/open_spec.rb +0 -19
  291. data/spec/rails_recording_spec.rb +0 -281
  292. data/spec/rails_spec_helper.rb +0 -107
  293. data/spec/rails_test_spec.rb +0 -35
  294. data/spec/railtie_spec.rb +0 -25
  295. data/spec/record_net_http_spec.rb +0 -161
  296. data/spec/record_sql_rails_pg_spec.rb +0 -59
  297. data/spec/remote_recording_spec.rb +0 -108
  298. data/spec/service/config_analyzer_spec.rb +0 -102
  299. data/spec/service/integration_test_path_finder_spec.rb +0 -24
  300. data/spec/service/validator/violation_spec.rb +0 -68
  301. data/spec/spec_helper.rb +0 -37
  302. data/spec/swagger/swagger_spec.rb +0 -85
  303. data/spec/util_spec.rb +0 -38
  304. data/test/agent_setup_init_test.rb +0 -39
  305. data/test/agent_setup_status_test.rb +0 -84
  306. data/test/agent_setup_validate_test.rb +0 -102
  307. data/test/bundle_vendor_test.rb +0 -35
  308. data/test/cucumber_test.rb +0 -72
  309. data/test/expectations/openssl_test_key_sign1.json +0 -53
  310. data/test/expectations/openssl_test_key_sign2-3.1.json +0 -53
  311. data/test/expectations/openssl_test_key_sign2.json +0 -58
  312. data/test/fixtures/bundle_vendor_app/Gemfile +0 -8
  313. data/test/fixtures/bundle_vendor_app/appmap.yml +0 -4
  314. data/test/fixtures/bundle_vendor_app/cli.rb +0 -54
  315. data/test/fixtures/cli_record_test/appmap.yml +0 -3
  316. data/test/fixtures/cli_record_test/lib/cli_record_test/main.rb +0 -9
  317. data/test/fixtures/cucumber4_recorder/Gemfile +0 -5
  318. data/test/fixtures/cucumber4_recorder/appmap.yml +0 -3
  319. data/test/fixtures/cucumber4_recorder/features/say_hello.feature +0 -5
  320. data/test/fixtures/cucumber4_recorder/features/support/env.rb +0 -5
  321. data/test/fixtures/cucumber4_recorder/features/support/hooks.rb +0 -11
  322. data/test/fixtures/cucumber4_recorder/features/support/steps.rb +0 -9
  323. data/test/fixtures/cucumber4_recorder/lib/hello.rb +0 -7
  324. data/test/fixtures/cucumber_recorder/Gemfile +0 -5
  325. data/test/fixtures/cucumber_recorder/appmap.yml +0 -3
  326. data/test/fixtures/cucumber_recorder/features/say_hello.feature +0 -5
  327. data/test/fixtures/cucumber_recorder/features/support/env.rb +0 -5
  328. data/test/fixtures/cucumber_recorder/features/support/hooks.rb +0 -11
  329. data/test/fixtures/cucumber_recorder/features/support/steps.rb +0 -9
  330. data/test/fixtures/cucumber_recorder/lib/hello.rb +0 -7
  331. data/test/fixtures/gem_test/Gemfile +0 -7
  332. data/test/fixtures/gem_test/appmap.yml +0 -3
  333. data/test/fixtures/gem_test/test/parser_test.rb +0 -12
  334. data/test/fixtures/minitest_recorder/Gemfile +0 -5
  335. data/test/fixtures/minitest_recorder/appmap.yml +0 -3
  336. data/test/fixtures/minitest_recorder/lib/hello.rb +0 -5
  337. data/test/fixtures/minitest_recorder/test/hello_test.rb +0 -12
  338. data/test/fixtures/mocha_mock_app/Gemfile +0 -5
  339. data/test/fixtures/mocha_mock_app/appmap.yml +0 -5
  340. data/test/fixtures/mocha_mock_app/lib/sheep.rb +0 -5
  341. data/test/fixtures/mocha_mock_app/test/sheep_test.rb +0 -18
  342. data/test/fixtures/openssl_recorder/Gemfile +0 -3
  343. data/test/fixtures/openssl_recorder/appmap.yml +0 -3
  344. data/test/fixtures/openssl_recorder/lib/openssl_cert_sign.rb +0 -94
  345. data/test/fixtures/openssl_recorder/lib/openssl_encrypt.rb +0 -34
  346. data/test/fixtures/openssl_recorder/lib/openssl_key_sign.rb +0 -28
  347. data/test/fixtures/process_recorder/appmap.yml +0 -3
  348. data/test/fixtures/process_recorder/hello.rb +0 -9
  349. data/test/fixtures/rspec_recorder/Gemfile +0 -5
  350. data/test/fixtures/rspec_recorder/appmap.yml +0 -3
  351. data/test/fixtures/rspec_recorder/lib/hello.rb +0 -5
  352. data/test/fixtures/rspec_recorder/spec/decorated_hello_spec.rb +0 -21
  353. data/test/fixtures/rspec_recorder/spec/labeled_hello_spec.rb +0 -9
  354. data/test/fixtures/rspec_recorder/spec/plain_hello_spec.rb +0 -9
  355. data/test/gem_test.rb +0 -35
  356. data/test/inspect_cli_test.rb +0 -12
  357. data/test/minitest_test.rb +0 -37
  358. data/test/mock_compatibility_test.rb +0 -45
  359. data/test/openssl_test.rb +0 -54
  360. data/test/record_process_test.rb +0 -35
  361. data/test/rspec_test.rb +0 -63
  362. data/test/test_helper.rb +0 -8
data/spec/open_spec.rb DELETED
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe AppMap::Open do
6
- context 'a block of Ruby code' do
7
- it 'opens in the browser' do
8
- appmap = AppMap.record do
9
- File.read __FILE__
10
- end
11
-
12
- open = AppMap::Open.new(appmap)
13
- server = open.run_server
14
- page = Net::HTTP.get URI.parse("http://localhost:#{open.port}")
15
- expect(page).to include(%(name="data" value='{"version))
16
- server.kill
17
- end
18
- end
19
- end
@@ -1,281 +0,0 @@
1
- require 'rails_spec_helper'
2
-
3
- # Rails5 doesn't work with Ruby 3.x
4
- def default_rails_versions
5
- testing_ruby_2? ? [ 5, 6 ] : [ 6 ]
6
- end
7
-
8
- def rails_versions
9
- Array(ENV['RAILS_VERSIONS'] || default_rails_versions)
10
- end
11
-
12
- describe 'Rails' do
13
- rails_versions.each do |rails_major_version| # rubocop:disable Metrics/BlockLength
14
- context "#{rails_major_version}" do
15
- include_context 'Rails app pg database', "spec/fixtures/rails#{rails_major_version}_users_app" unless use_existing_data?
16
- include_context 'rails integration test setup'
17
-
18
- describe 'an API route' do
19
- describe 'creating an object' do
20
- let(:appmap_json_file) do
21
- 'Api_UsersController_POST_api_users_with_required_parameters_creates_a_user.appmap.json'
22
- end
23
-
24
- it 'http_server_request is recorded in the appmap' do
25
- expect(events).to include(
26
- hash_including(
27
- 'http_server_request' => hash_including(
28
- 'request_method' => 'POST',
29
- 'normalized_path_info' => '/api/users',
30
- 'path_info' => '/api/users',
31
- 'headers' => hash_including('Content-Type' => 'application/x-www-form-urlencoded'),
32
- ),
33
- 'message' => include(
34
- hash_including(
35
- 'name' => 'login',
36
- 'class' => 'String',
37
- 'value' => 'alice',
38
- 'object_id' => Integer
39
- ),
40
- hash_including(
41
- 'name' => 'password',
42
- 'class' => 'String',
43
- 'value' => '[FILTERED]',
44
- 'object_id' => Integer
45
- )
46
- )
47
- )
48
- )
49
- end
50
-
51
- it 'http_server_response is recorded in the appmap' do
52
- expect(events).to include(
53
- hash_including(
54
- 'http_server_response' => hash_including(
55
- 'status_code' => 201,
56
- 'headers' => hash_including('Content-Type' => 'application/json; charset=utf-8'),
57
- ),
58
- 'return_value' => hash_including('class' => 'Hash', 'object_id' => Integer, 'properties' => include({'name' => 'login', 'class' => 'String'})),
59
- )
60
- )
61
- end
62
-
63
- it 'properly captures method parameters in the appmap' do
64
- expect(events).to include hash_including(
65
- 'event' => 'call',
66
- 'thread_id' => Integer,
67
- 'defined_class' => 'Api::UsersController',
68
- 'method_id' => 'build_user',
69
- 'path' => 'app/controllers/api/users_controller.rb',
70
- 'lineno' => Integer,
71
- 'static' => false,
72
- 'parameters' => include(
73
- 'name' => 'params',
74
- 'class' => 'ActiveSupport::HashWithIndifferentAccess',
75
- 'object_id' => Integer,
76
- 'size' => 1,
77
- 'value' => '{login=>alice}',
78
- 'kind' => 'req'
79
- ),
80
- 'receiver' => anything
81
- )
82
- end
83
-
84
- it 'returns a minimal event' do
85
- expect(events).to include hash_including(
86
- 'event' => 'return',
87
- 'return_value' => Hash,
88
- 'id' => Integer,
89
- 'thread_id' => Integer,
90
- 'parent_id' => Integer,
91
- 'elapsed' => Numeric
92
- )
93
- end
94
-
95
- it 'captures log events' do
96
- expect(events).to include hash_including(
97
- 'event' => 'call',
98
- 'defined_class' => 'Logger::LogDevice',
99
- 'method_id' => 'write',
100
- 'static' => false
101
- )
102
- end
103
-
104
- context 'with an object-style message' do
105
- let(:appmap_json_file) { 'Api_UsersController_POST_api_users_with_required_parameters_with_object-style_parameters_creates_a_user.appmap.json' }
106
-
107
- it 'message properties are recorded in the appmap' do
108
- expect(events).to include(
109
- hash_including(
110
- 'message' => include(
111
- hash_including(
112
- 'name' => 'user',
113
- 'properties' => [
114
- { 'name' => 'login', 'class' => 'String' },
115
- { 'name' => 'password', 'class' => 'String' }
116
- ]
117
- )
118
- )
119
- )
120
- )
121
- end
122
- end
123
- end
124
-
125
- describe 'listing objects' do
126
- context 'with a custom header' do
127
- let(:appmap_json_file) { 'Api_UsersController_GET_api_users_with_a_custom_header_lists_the_users.appmap.json' }
128
-
129
- it 'custom header is recorded in the appmap' do
130
- expect(events).to include(
131
- hash_including(
132
- 'http_server_request' => hash_including(
133
- 'headers' => hash_including('X-Sandwich' => 'turkey')
134
- )
135
- )
136
- )
137
- end
138
- end
139
- end
140
- end
141
-
142
- describe 'a UI route' do
143
- describe 'rendering a page using a template file' do
144
- let(:appmap_json_file) do
145
- 'UsersController_GET_users_lists_the_users.appmap.json'
146
- end
147
-
148
- it 'records the template file' do
149
- expect(events).to include hash_including(
150
- 'event' => 'call',
151
- 'defined_class' => 'app_views_users_index_html_haml',
152
- 'method_id' => 'render',
153
- 'path' => 'app/views/users/index.html.haml'
154
- )
155
-
156
- expect(appmap['classMap']).to include hash_including(
157
- 'name' => 'app',
158
- 'children' => include(hash_including(
159
- 'name' => 'views',
160
- 'children' => include(hash_including(
161
- 'name' => 'app_views_users_index_html_haml',
162
- 'children' => include(hash_including(
163
- 'name' => 'render',
164
- 'type' => 'function',
165
- 'location' => 'app/views/users/index.html.haml',
166
- 'static' => true,
167
- 'labels' => [ 'mvc.template' ]
168
- )))))))
169
- expect(appmap['classMap']).to include hash_including(
170
- 'name' => 'app',
171
- 'children' => include(hash_including(
172
- 'name' => 'views',
173
- 'children' => include(hash_including(
174
- 'name' => 'app_views_layouts_application_html_haml',
175
- 'children' => include(hash_including(
176
- 'name' => 'render',
177
- 'type' => 'function',
178
- 'location' => 'app/views/layouts/application.html.haml',
179
- 'static' => true,
180
- 'labels' => [ 'mvc.template' ]
181
- )))))))
182
- end
183
- end
184
-
185
- describe 'rendering a page using a text template' do
186
- let(:appmap_json_file) do
187
- 'UsersController_GET_users_login_shows_the_user.appmap.json'
188
- end
189
-
190
- it 'records the normalized path info' do
191
- expect(events).to include(
192
- hash_including(
193
- 'http_server_request' => {
194
- 'request_method' => 'GET',
195
- 'path_info' => '/users/alice',
196
- 'normalized_path_info' => '/users/{id}',
197
- 'headers' => {
198
- 'Host' => 'test.host',
199
- 'User-Agent' => 'Rails Testing'
200
- }
201
- }
202
- )
203
- )
204
- end
205
-
206
- it 'ignores the text template' do
207
- expect(events).to_not include hash_including(
208
- 'event' => 'call',
209
- 'method_id' => 'render',
210
- 'render_template' => anything
211
- )
212
-
213
- expect(appmap['classMap']).to_not include hash_including(
214
- 'name' => 'views',
215
- 'children' => include(hash_including(
216
- 'name' => 'ViewTemplate',
217
- 'children' => include(hash_including(
218
- 'name' => 'render',
219
- 'type' => 'function',
220
- 'location' => 'text template'
221
- ))
222
- ))
223
- )
224
- end
225
-
226
- it 'records and labels view rendering' do
227
- expect(events).to include hash_including(
228
- 'event' => 'call',
229
- 'thread_id' => Numeric,
230
- 'defined_class' => 'inline_template',
231
- 'method_id' => 'render'
232
- )
233
-
234
- expect(appmap['classMap']).to include hash_including(
235
- 'name' => 'actionview',
236
- 'children' => include(hash_including(
237
- 'name' => 'ActionView',
238
- 'children' => include(hash_including(
239
- # Rails 6/5 difference
240
- 'name' => /^(Template)?Renderer$/,
241
- 'children' => include(hash_including(
242
- 'name' => 'render',
243
- 'labels' => ['mvc.view']
244
- ))
245
- ))
246
- ))
247
- )
248
- end
249
- end
250
- end
251
- end
252
- end
253
-
254
- describe 'with default appmap.yml' do
255
- include_context 'Rails app pg database', "spec/fixtures/rails6_users_app" unless use_existing_data?
256
- include_context 'rails integration test setup'
257
-
258
- let(:appmap_json_file) do
259
- 'Api_UsersController_POST_api_users_with_required_parameters_creates_a_user.appmap.json'
260
- end
261
-
262
- it 'http_server_request is recorded' do
263
- expect(events).to include(
264
- hash_including(
265
- 'http_server_request' => hash_including(
266
- 'request_method' => 'POST',
267
- 'path_info' => '/api/users'
268
- )
269
- )
270
- )
271
- end
272
-
273
- it 'controller method is recorded' do
274
- expect(events).to include hash_including(
275
- 'defined_class' => 'Api::UsersController',
276
- 'method_id' => 'build_user',
277
- 'path' => 'app/controllers/api/users_controller.rb',
278
- )
279
- end
280
- end
281
- end
@@ -1,107 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'open3'
4
-
5
- require 'spec_helper'
6
- require 'active_support'
7
- require 'active_support/core_ext'
8
-
9
- def testing_ruby_2?
10
- RUBY_VERSION.split('.')[0].to_i == 2
11
- end
12
-
13
- class TestRailsApp
14
- def initialize(fixture_dir)
15
- @fixture_dir = fixture_dir
16
- end
17
-
18
- attr_reader :fixture_dir
19
-
20
- def run_cmd(cmd, env = {})
21
- run_process method(:system), cmd, env
22
- end
23
-
24
- def spawn_cmd(cmd, env = {})
25
- puts "Spawning `#{cmd}` in #{fixture_dir}..."
26
- run_process Process.method(:spawn), cmd, env
27
- end
28
-
29
- def capture_cmd(cmd, env = {})
30
- puts "Capturing `#{cmd}` in #{fixture_dir}..."
31
- run_process(Open3.method(:capture2), cmd, env).first
32
- end
33
-
34
- def database_name
35
- # This is used locally too, so make the name nice and unique.
36
- @database_name ||= "appland-rails-test-#{Random.new.bytes(8).unpack1('h*')}"
37
- end
38
-
39
- def bundle
40
- return if @bundled
41
-
42
- run_cmd 'bundle'
43
- @bundled = true
44
- end
45
-
46
- def prepare_db
47
- return if @db_prepared
48
-
49
- bundle
50
- run_cmd './bin/rake db:create db:schema:load'
51
- @db_prepared = true
52
- at_exit { drop_db }
53
- end
54
-
55
- def drop_db
56
- return unless @db_prepared
57
-
58
- run_cmd './bin/rake db:drop'
59
- @db_prepared = false
60
- end
61
-
62
- def tmpdir
63
- @tmpdir ||= File.join(fixture_dir, 'tmp')
64
- end
65
-
66
- def run_specs
67
- return if @specs_ran or use_existing_data?
68
-
69
- prepare_db
70
- FileUtils.rm_rf tmpdir
71
- run_cmd \
72
- './bin/rspec spec/controllers/users_controller_spec.rb spec/controllers/users_controller_api_spec.rb',
73
- 'APPMAP' => 'true'
74
- @specs_ran = true
75
- end
76
-
77
- def self.for_fixture(fixture_dir)
78
- @apps ||= {}
79
- @apps[fixture_dir] ||= TestRailsApp.new fixture_dir
80
- end
81
-
82
- protected
83
-
84
- def run_process(method, cmd, env, options = {})
85
- Bundler.with_clean_env do
86
- method.call \
87
- env.merge('TEST_DATABASE' => database_name),
88
- cmd,
89
- options.merge(chdir: fixture_dir)
90
- end
91
- end
92
- end
93
-
94
- shared_context 'Rails app pg database' do |dir|
95
- before(:all) { @app = TestRailsApp.for_fixture dir }
96
- let(:app) { @app }
97
- end
98
-
99
- shared_context 'rails integration test setup' do
100
- let(:tmpdir) { app.tmpdir }
101
-
102
- before(:all) { @app.run_specs } unless use_existing_data?
103
-
104
- let(:appmap_json_path) { File.join(tmpdir, 'appmap/rspec', appmap_json_file) }
105
- let(:appmap) { JSON.parse File.read(appmap_json_path) }
106
- let(:events) { appmap['events'] }
107
- end
@@ -1,35 +0,0 @@
1
- require 'rails_spec_helper'
2
-
3
- # Rails5 doesn't work with Ruby 3.x, Rails 7 doesn't work with Ruby < 2.7.
4
- def default_rails_versions
5
- if testing_ruby_2?
6
- if Gem::Requirement.create('>= 2.7') =~ Gem::Version.new(RUBY_VERSION)
7
- [ 5, 6, 7 ]
8
- else
9
- [ 5, 6 ]
10
- end
11
- else
12
- [ 6, 7 ]
13
- end
14
- end
15
-
16
- def rails_versions
17
- Array(ENV['RAILS_VERSIONS'] || default_rails_versions)
18
- end
19
-
20
- describe 'Rails' do
21
- rails_versions.each do |rails_major_version| # rubocop:disable Metrics/BlockLength
22
- context "#{rails_major_version}" do
23
- include_context 'Rails app pg database', "spec/fixtures/rails#{rails_major_version}_users_app" unless use_existing_data?
24
-
25
- it 'runs tests with APPMAP=true' do
26
- app.prepare_db
27
- app.run_cmd \
28
- 'bundle exec rake',
29
- 'RAILS_ENV' => 'test',
30
- 'APPMAP' => 'true',
31
- 'TEST_OPTS' => '--verbose'
32
- end
33
- end
34
- end
35
- end
data/spec/railtie_spec.rb DELETED
@@ -1,25 +0,0 @@
1
- require 'rails_spec_helper'
2
-
3
- describe 'AppMap tracer via Railtie' do
4
- include_context 'Rails app pg database', 'spec/fixtures/rails6_users_app' do
5
- let(:env) { {} }
6
-
7
- let(:command_output) do
8
- app.prepare_db
9
- app.capture_cmd(%{./bin/rails r "puts AppMap.instance_variable_get('@configuration').nil?"}, env).strip
10
- end
11
-
12
- describe 'with APPMAP=false' do
13
- let(:env) { { 'APPMAP' => 'false' } }
14
- it 'is disabled' do
15
- expect(command_output).to eq('true')
16
- end
17
- end
18
- describe 'with APPMAP=true' do
19
- let(:env) { { 'APPMAP' => 'true' } }
20
- it 'is enabled' do
21
- expect(command_output).to eq('false')
22
- end
23
- end
24
- end
25
- end
@@ -1,161 +0,0 @@
1
- require 'spec_helper'
2
- require 'diffy'
3
- require 'rack'
4
- require 'webrick'
5
- require 'rack/handler/webrick'
6
-
7
- class HelloWorldApp
8
- def call(env)
9
- req = Rack::Request.new(env)
10
- case req.path_info
11
- when /hello/
12
- [200, {"Content-Type" => "text/html"}, ["Hello World!"]]
13
- when /goodbye/
14
- [500, {"Content-Type" => "text/html"}, ["Goodbye Cruel World!"]]
15
- else
16
- [404, {"Content-Type" => "text/html"}, ["I'm Lost!"]]
17
- end
18
- end
19
- end
20
-
21
- describe 'Net::HTTP handler' do
22
- include_context 'collect events'
23
-
24
- def get_hello(params: nil)
25
- http = Net::HTTP.new('localhost', 19292)
26
- http.get [ '/hello', params ].compact.join('?')
27
- end
28
-
29
- before(:all) do
30
- @rack_thread = Thread.new do
31
- Rack::Handler::WEBrick.run HelloWorldApp.new, Port: 19292
32
- end
33
- 10.times do
34
- sleep 0.1
35
- break if get_hello.code.to_i == 200
36
- end
37
- raise "Web server didn't start" unless get_hello.code.to_i == 200
38
- end
39
-
40
- after(:all) do
41
- @rack_thread.kill
42
- end
43
-
44
- def start_recording
45
- AppMap.configuration = configuration
46
- AppMap::Hook.new(configuration).enable
47
-
48
- @tracer = AppMap.tracing.trace
49
- AppMap::Event.reset_id_counter
50
- end
51
-
52
- def record(&block)
53
- start_recording
54
- begin
55
- yield
56
- ensure
57
- stop_recording
58
- end
59
- end
60
-
61
- def stop_recording
62
- AppMap.tracing.delete(@tracer)
63
- end
64
-
65
- context 'with trace enabled' do
66
- let(:configuration) { AppMap::Config.new('record_net_http_spec') }
67
-
68
- after do
69
- AppMap.configuration = nil
70
- end
71
-
72
- describe 'GET request' do
73
- it 'with a single query parameter' do
74
- record do
75
- get_hello(params: 'msg=hi')
76
- end
77
-
78
- events = collect_events(@tracer).to_yaml
79
- expect(Diffy::Diff.new(<<~EVENTS, events).to_s).to eq('')
80
- ---
81
- - :id: 1
82
- :event: :call
83
- :http_client_request:
84
- :request_method: GET
85
- :url: http://localhost:19292/hello
86
- :headers:
87
- Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
88
- Accept: "*/*"
89
- User-Agent: Ruby
90
- Connection: close
91
- :message:
92
- - :name: msg
93
- :class: String
94
- :value: hi
95
- - :id: 2
96
- :event: :return
97
- :parent_id: 1
98
- :http_client_response:
99
- :status_code: 200
100
- :headers:
101
- Content-Type: text/html
102
- Server: WEBrick
103
- Date: "<instanceof date>"
104
- Content-Length: '12'
105
- Connection: close
106
- EVENTS
107
- end
108
-
109
- it 'with a multi-valued query parameter' do
110
- record do
111
- get_hello(params: 'ary[]=1&ary[]=2')
112
- end
113
-
114
- event = collect_events(@tracer).first.to_yaml
115
- expect(Diffy::Diff.new(<<~EVENT, event).to_s).to eq('')
116
- ---
117
- :id: 1
118
- :event: :call
119
- :http_client_request:
120
- :request_method: GET
121
- :url: http://localhost:19292/hello
122
- :headers:
123
- Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
124
- Accept: "*/*"
125
- User-Agent: Ruby
126
- Connection: close
127
- :message:
128
- - :name: ary
129
- :class: Array
130
- :value: "[1, 2]"
131
- EVENT
132
- end
133
-
134
- it 'with a URL encoded query parameter' do
135
- msg = 'foo/bar?baz'
136
- record do
137
- get_hello(params: "msg=#{CGI.escape msg}")
138
- end
139
-
140
- event = collect_events(@tracer).first.to_yaml
141
- expect(Diffy::Diff.new(<<~EVENT, event).to_s).to eq('')
142
- ---
143
- :id: 1
144
- :event: :call
145
- :http_client_request:
146
- :request_method: GET
147
- :url: http://localhost:19292/hello
148
- :headers:
149
- Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
150
- Accept: "*/*"
151
- User-Agent: Ruby
152
- Connection: close
153
- :message:
154
- - :name: msg
155
- :class: String
156
- :value: #{msg}
157
- EVENT
158
- end
159
- end
160
- end
161
- end
@@ -1,59 +0,0 @@
1
- require 'rails_spec_helper'
2
-
3
- describe 'SQL events' do
4
- include_context 'Rails app pg database', 'spec/fixtures/rails6_users_app' do
5
- def self.check_queries(cases)
6
- cases.each do |test_case, query|
7
- context "in #{test_case}" do
8
- let(:test_case) { test_case }
9
- it "captures #{query}" do
10
- expect(sql_events).to include sql_query query
11
- end
12
- end
13
- end
14
- end
15
-
16
- context 'with Sequel' do
17
- before(:context) { run_specs 'sequel' }
18
-
19
- check_queries(
20
- 'Api_UsersController_POST_api_users_with_required_parameters_creates_a_user' =>
21
- %(INSERT INTO "users" ("login") VALUES ('alice') RETURNING *),
22
- 'Api_UsersController_GET_api_users_lists_the_users' => %(SELECT * FROM "users")
23
- )
24
- end
25
-
26
- context 'with ActiveRecord' do
27
- before(:context) { run_specs 'activerecord' }
28
-
29
- check_queries(
30
- 'Api_UsersController_POST_api_users_with_required_parameters_creates_a_user' =>
31
- %(INSERT INTO "users" ("login") VALUES ($1) RETURNING "id"),
32
- 'Api_UsersController_GET_api_users_lists_the_users' => %(SELECT "users".* FROM "users")
33
- )
34
- end
35
-
36
- def run_specs(orm_module)
37
- @app.prepare_db
38
- @app.run_cmd \
39
- './bin/rspec spec/controllers/users_controller_api_spec.rb:8 spec/controllers/users_controller_api_spec.rb:29',
40
- 'ORM_MODULE' => orm_module,
41
- 'RAILS_ENV' => 'test',
42
- 'APPMAP' => 'true'
43
- end
44
-
45
- let(:appmap_json) { File.join tmpdir, "appmap/rspec/#{test_case}.appmap.json" }
46
- let(:appmap) { JSON.parse(File.read(appmap_json)) }
47
- let(:tmpdir) { app.tmpdir }
48
- let(:sql_events) { appmap['events'].select { |ev| ev.include? 'sql_query' } }
49
-
50
- RSpec::Matchers.define_negated_matcher :not_include, :include
51
- def sql_query(query)
52
- (include('sql_query' => (include 'sql' => query)))
53
- .and(not_include('defined_class'))
54
- .and(not_include('method_id'))
55
- .and(not_include('path'))
56
- .and(not_include('lineno'))
57
- end
58
- end
59
- end