appmap 0.37.0 → 0.40.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +1 -1
- data/.rubocop.yml +12 -1
- data/.travis.yml +2 -23
- data/CHANGELOG.md +24 -0
- data/CONTRIBUTING.md +22 -0
- data/README.md +79 -50
- data/Rakefile +3 -3
- data/lib/appmap/class_map.rb +25 -8
- data/lib/appmap/config.rb +22 -10
- data/lib/appmap/event.rb +16 -1
- data/lib/appmap/hook.rb +11 -3
- data/lib/appmap/hook/method.rb +18 -12
- data/lib/appmap/rails/request_handler.rb +25 -4
- data/lib/appmap/railtie.rb +1 -5
- data/lib/appmap/trace.rb +18 -7
- data/lib/appmap/version.rb +2 -2
- data/spec/abstract_controller_base_spec.rb +132 -67
- data/spec/fixtures/hook/instance_method.rb +4 -0
- data/spec/fixtures/hook/labels.rb +6 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/.dockerignore +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/.gitignore +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/.rspec +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/.ruby-version +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/Dockerfile +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/Dockerfile.pg +0 -0
- data/spec/fixtures/rails5_users_app/Gemfile +50 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/Rakefile +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/api/users_controller.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/application_controller.rb +0 -0
- data/spec/fixtures/{rails4_users_app/app/assets/images → rails5_users_app/app/controllers/concerns}/.keep +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/health_controller.rb +0 -0
- data/spec/fixtures/rails5_users_app/app/controllers/users_controller.rb +13 -0
- data/spec/fixtures/{rails4_users_app/app/models → rails5_users_app/app/models/activerecord}/user.rb +0 -0
- data/spec/fixtures/{rails4_users_app/app/controllers → rails5_users_app/app/models}/concerns/.keep +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/models/sequel/user.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/app/views/layouts/application.html.haml +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/app/views/users/index.html.haml +0 -0
- data/spec/fixtures/rails5_users_app/appmap.yml +4 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/appmap +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/byebug +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/gli +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/htmldiff +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ldiff +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/nokogiri +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rackup +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rails +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rake +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rspec +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ruby-parse +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ruby-rewrite +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/sequel +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/setup +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/sprockets +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/thor +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/update +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config.ru +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/application.rb +2 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/boot.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/credentials.yml.enc +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/database.yml +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environment.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/development.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/production.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/test.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/application_controller_renderer.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/cors.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/filter_parameter_logging.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/inflections.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/mime_types.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/record_button.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/wrap_parameters.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/locales/en.yml +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/routes.rb +1 -2
- data/spec/fixtures/{rails_users_app → rails5_users_app}/create_app +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/db/migrate/20190728211408_create_users.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/db/schema.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/docker-compose.yml +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/api_users.feature +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/env.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/hooks.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/steps.rb +0 -0
- data/spec/fixtures/{rails4_users_app/app/mailers → rails5_users_app/lib/tasks}/.keep +0 -0
- data/spec/fixtures/{rails4_users_app/app/models → rails5_users_app/log}/.keep +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/public/robots.txt +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/controllers/users_controller_api_spec.rb +1 -1
- data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_spec.rb +27 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/models/user_spec.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/rails_helper.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/spec/spec_helper.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/users_app/.gitignore +0 -0
- data/spec/fixtures/rails6_users_app/.dockerignore +1 -0
- data/spec/fixtures/rails6_users_app/.gitignore +39 -0
- data/spec/fixtures/rails6_users_app/.rspec +1 -0
- data/spec/fixtures/rails6_users_app/.ruby-version +1 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/Dockerfile +3 -4
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/Dockerfile.pg +1 -1
- data/spec/fixtures/{rails_users_app → rails6_users_app}/Gemfile +3 -4
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/Rakefile +1 -1
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/app/controllers/api/users_controller.rb +1 -1
- data/spec/fixtures/rails6_users_app/app/controllers/application_controller.rb +2 -0
- data/spec/fixtures/{rails4_users_app/app/models → rails6_users_app/app/controllers}/concerns/.keep +0 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/app/controllers/health_controller.rb +1 -1
- data/spec/fixtures/rails6_users_app/app/controllers/users_controller.rb +13 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/app/models/activerecord/user.rb +0 -0
- data/spec/fixtures/{rails4_users_app/lib/assets → rails6_users_app/app/models/concerns}/.keep +0 -0
- data/spec/fixtures/rails6_users_app/app/models/sequel/user.rb +25 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/app/views/layouts/application.html.haml +0 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/app/views/users/index.html.haml +0 -0
- data/spec/fixtures/rails6_users_app/appmap.yml +5 -0
- data/spec/fixtures/rails6_users_app/bin/appmap +29 -0
- data/spec/fixtures/rails6_users_app/bin/byebug +29 -0
- data/spec/fixtures/rails6_users_app/bin/gli +29 -0
- data/spec/fixtures/rails6_users_app/bin/htmldiff +29 -0
- data/spec/fixtures/rails6_users_app/bin/ldiff +29 -0
- data/spec/fixtures/rails6_users_app/bin/nokogiri +29 -0
- data/spec/fixtures/rails6_users_app/bin/rackup +29 -0
- data/spec/fixtures/rails6_users_app/bin/rails +4 -0
- data/spec/fixtures/rails6_users_app/bin/rake +29 -0
- data/spec/fixtures/rails6_users_app/bin/rspec +29 -0
- data/spec/fixtures/rails6_users_app/bin/ruby-parse +29 -0
- data/spec/fixtures/rails6_users_app/bin/ruby-rewrite +29 -0
- data/spec/fixtures/rails6_users_app/bin/sequel +29 -0
- data/spec/fixtures/rails6_users_app/bin/setup +25 -0
- data/spec/fixtures/rails6_users_app/bin/sprockets +29 -0
- data/spec/fixtures/rails6_users_app/bin/thor +29 -0
- data/spec/fixtures/rails6_users_app/bin/update +25 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config.ru +2 -1
- data/spec/fixtures/rails6_users_app/config/application.rb +53 -0
- data/spec/fixtures/rails6_users_app/config/boot.rb +3 -0
- data/spec/fixtures/rails6_users_app/config/credentials.yml.enc +1 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/database.yml +2 -2
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/environment.rb +1 -1
- data/spec/fixtures/rails6_users_app/config/environments/development.rb +40 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/environments/production.rb +19 -30
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/environments/test.rb +5 -11
- data/spec/fixtures/rails6_users_app/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/fixtures/rails6_users_app/config/initializers/cors.rb +16 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/filter_parameter_logging.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/inflections.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/mime_types.rb +0 -0
- data/spec/fixtures/rails6_users_app/config/initializers/record_button.rb +3 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/initializers/wrap_parameters.rb +1 -6
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/locales/en.yml +10 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/config/routes.rb +1 -1
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/create_app +7 -3
- data/spec/fixtures/rails6_users_app/db/migrate/20190728211408_create_users.rb +9 -0
- data/spec/fixtures/rails6_users_app/db/schema.rb +23 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/docker-compose.yml +3 -1
- data/spec/fixtures/rails6_users_app/features/api_users.feature +13 -0
- data/spec/fixtures/rails6_users_app/features/support/env.rb +4 -0
- data/spec/fixtures/rails6_users_app/features/support/hooks.rb +11 -0
- data/spec/fixtures/rails6_users_app/features/support/steps.rb +18 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/lib/tasks/.keep +0 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/log/.keep +0 -0
- data/spec/fixtures/rails6_users_app/public/robots.txt +1 -0
- data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb +29 -0
- data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_spec.rb +27 -0
- data/spec/fixtures/rails6_users_app/spec/models/user_spec.rb +39 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/spec/rails_helper.rb +3 -32
- data/spec/fixtures/{rails_users_app → rails6_users_app}/spec/spec_helper.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app/users_app}/.gitignore +8 -1
- data/spec/hook_spec.rb +111 -57
- data/spec/rails_spec_helper.rb +5 -5
- data/spec/railtie_spec.rb +31 -32
- data/spec/record_sql_rails_pg_spec.rb +62 -63
- data/spec/remote_recording_spec.rb +90 -89
- data/spec/rspec_feature_metadata_spec.rb +17 -18
- data/spec/spec_helper.rb +1 -0
- metadata +148 -139
- data/spec/abstract_controller4_base_spec.rb +0 -67
- data/spec/fixtures/rails4_users_app/.rbenv-gemsets +0 -2
- data/spec/fixtures/rails4_users_app/.ruby-version +0 -1
- data/spec/fixtures/rails4_users_app/Gemfile +0 -77
- data/spec/fixtures/rails4_users_app/README.rdoc +0 -28
- data/spec/fixtures/rails4_users_app/app/assets/javascripts/application.js +0 -16
- data/spec/fixtures/rails4_users_app/app/assets/stylesheets/application.css +0 -15
- data/spec/fixtures/rails4_users_app/app/controllers/application_controller.rb +0 -5
- data/spec/fixtures/rails4_users_app/app/controllers/users_controller.rb +0 -5
- data/spec/fixtures/rails4_users_app/app/helpers/application_helper.rb +0 -2
- data/spec/fixtures/rails4_users_app/appmap.yml +0 -3
- data/spec/fixtures/rails4_users_app/bin/rails +0 -9
- data/spec/fixtures/rails4_users_app/bin/setup +0 -29
- data/spec/fixtures/rails4_users_app/bin/spring +0 -17
- data/spec/fixtures/rails4_users_app/config/application.rb +0 -26
- data/spec/fixtures/rails4_users_app/config/boot.rb +0 -3
- data/spec/fixtures/rails4_users_app/config/environments/development.rb +0 -41
- data/spec/fixtures/rails4_users_app/config/initializers/assets.rb +0 -11
- data/spec/fixtures/rails4_users_app/config/initializers/cookies_serializer.rb +0 -3
- data/spec/fixtures/rails4_users_app/config/initializers/session_store.rb +0 -3
- data/spec/fixtures/rails4_users_app/config/initializers/to_time_preserves_timezone.rb +0 -10
- data/spec/fixtures/rails4_users_app/config/secrets.yml +0 -22
- data/spec/fixtures/rails4_users_app/db/migrate/20191127112304_create_users.rb +0 -10
- data/spec/fixtures/rails4_users_app/db/schema.rb +0 -26
- data/spec/fixtures/rails4_users_app/db/seeds.rb +0 -7
- data/spec/fixtures/rails4_users_app/public/404.html +0 -67
- data/spec/fixtures/rails4_users_app/public/422.html +0 -67
- data/spec/fixtures/rails4_users_app/public/500.html +0 -66
- data/spec/fixtures/rails4_users_app/public/favicon.ico +0 -0
- data/spec/fixtures/rails4_users_app/public/robots.txt +0 -5
- data/spec/fixtures/rails4_users_app/spec/controllers/users_controller_api_spec.rb +0 -49
- data/spec/fixtures/rails4_users_app/test/fixtures/users.yml +0 -9
- data/spec/fixtures/rails_users_app/app/controllers/concerns/.keep +0 -0
- data/spec/fixtures/rails_users_app/app/controllers/users_controller.rb +0 -5
- data/spec/fixtures/rails_users_app/app/models/concerns/.keep +0 -0
- data/spec/fixtures/rails_users_app/appmap.yml +0 -3
- data/spec/fixtures/rails_users_app/lib/tasks/.keep +0 -0
- data/spec/fixtures/rails_users_app/log/.keep +0 -0
- data/spec/record_sql_rails4_pg_spec.rb +0 -76
@@ -1,67 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/422.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The change you wanted was rejected.</h1>
|
62
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
-
</div>
|
64
|
-
<p>If you are the application owner check the logs for more information.</p>
|
65
|
-
</div>
|
66
|
-
</body>
|
67
|
-
</html>
|
@@ -1,66 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
-
<style>
|
7
|
-
body {
|
8
|
-
background-color: #EFEFEF;
|
9
|
-
color: #2E2F30;
|
10
|
-
text-align: center;
|
11
|
-
font-family: arial, sans-serif;
|
12
|
-
margin: 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
div.dialog {
|
16
|
-
width: 95%;
|
17
|
-
max-width: 33em;
|
18
|
-
margin: 4em auto 0;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.dialog > div {
|
22
|
-
border: 1px solid #CCC;
|
23
|
-
border-right-color: #999;
|
24
|
-
border-left-color: #999;
|
25
|
-
border-bottom-color: #BBB;
|
26
|
-
border-top: #B00100 solid 4px;
|
27
|
-
border-top-left-radius: 9px;
|
28
|
-
border-top-right-radius: 9px;
|
29
|
-
background-color: white;
|
30
|
-
padding: 7px 12% 0;
|
31
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
-
}
|
33
|
-
|
34
|
-
h1 {
|
35
|
-
font-size: 100%;
|
36
|
-
color: #730E15;
|
37
|
-
line-height: 1.5em;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.dialog > p {
|
41
|
-
margin: 0 0 1em;
|
42
|
-
padding: 1em;
|
43
|
-
background-color: #F7F7F7;
|
44
|
-
border: 1px solid #CCC;
|
45
|
-
border-right-color: #999;
|
46
|
-
border-left-color: #999;
|
47
|
-
border-bottom-color: #999;
|
48
|
-
border-bottom-left-radius: 4px;
|
49
|
-
border-bottom-right-radius: 4px;
|
50
|
-
border-top-color: #DADADA;
|
51
|
-
color: #666;
|
52
|
-
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
-
}
|
54
|
-
</style>
|
55
|
-
</head>
|
56
|
-
|
57
|
-
<body>
|
58
|
-
<!-- This file lives in public/500.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>We're sorry, but something went wrong.</h1>
|
62
|
-
</div>
|
63
|
-
<p>If you are the application owner check the logs for more information.</p>
|
64
|
-
</div>
|
65
|
-
</body>
|
66
|
-
</html>
|
File without changes
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
require 'rack/test'
|
3
|
-
|
4
|
-
RSpec.describe Api::UsersController, feature_group: 'Users', type: :controller, appmap: true do
|
5
|
-
|
6
|
-
describe 'POST /api/users', feature: 'Create a user' do
|
7
|
-
describe 'with required parameters' do
|
8
|
-
it 'creates a user' do
|
9
|
-
post :create, { login: 'alice', password: 'foobar' }
|
10
|
-
expect(response.status).to eq(201)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
describe 'with a missing parameter' do
|
14
|
-
it 'reports error 422' do
|
15
|
-
post :create, {}
|
16
|
-
expect(response.status).to eq(422)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
describe 'GET /api/users', feature: 'List users' do
|
21
|
-
before do
|
22
|
-
post :create, { login: 'alice', password: 'secret' }
|
23
|
-
end
|
24
|
-
it 'lists the users' do
|
25
|
-
post :index, {}
|
26
|
-
users = JSON.parse(response.body)
|
27
|
-
expect(users.map { |r| r['login'] }).to include('alice')
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'when parameterizing a string' do
|
32
|
-
context 'using the inflector' do
|
33
|
-
it 'uses the default separator' do
|
34
|
-
expect(ActiveSupport::Inflector.parameterize('foo bar baz')).to eq('foo-bar-baz')
|
35
|
-
end
|
36
|
-
it 'uses a specified separator' do
|
37
|
-
expect(ActiveSupport::Inflector.parameterize('foo bar baz', '+')).to eq('foo+bar+baz')
|
38
|
-
end
|
39
|
-
end
|
40
|
-
context 'with #parameterize' do
|
41
|
-
it 'uses the default separator' do
|
42
|
-
expect('foo bar baz'.parameterize).to eq('foo-bar-baz')
|
43
|
-
end
|
44
|
-
it 'uses a specified separator' do
|
45
|
-
expect('foo bar baz'.parameterize('+')).to eq('foo+bar+baz')
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,76 +0,0 @@
|
|
1
|
-
require 'rails_spec_helper'
|
2
|
-
|
3
|
-
describe 'Record SQL queries in a Rails4 app' do
|
4
|
-
before(:all) { @fixture_dir = 'spec/fixtures/rails4_users_app' }
|
5
|
-
include_context 'Rails app pg database'
|
6
|
-
|
7
|
-
around(:each) do |example|
|
8
|
-
FileUtils.rm_rf tmpdir
|
9
|
-
FileUtils.mkdir_p tmpdir
|
10
|
-
cmd = "docker-compose run --rm -e ORM_MODULE=#{orm_module} -e APPMAP=true -v #{File.absolute_path tmpdir}:/app/tmp app ./bin/rspec spec/controllers/users_controller_api_spec.rb:#{test_line_number}"
|
11
|
-
run_cmd cmd, chdir: @fixture_dir
|
12
|
-
|
13
|
-
example.run
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:tmpdir) { "tmp/spec/record_sql_rails_pg_spec" }
|
17
|
-
let(:appmap) { JSON.parse(File.read(appmap_json)).to_yaml }
|
18
|
-
|
19
|
-
context 'when running specs' do
|
20
|
-
let(:test_line_number) { 31 }
|
21
|
-
let(:orm_module) { 'activerecord' }
|
22
|
-
|
23
|
-
it { is_expected.to be }
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'while creating a new record' do
|
27
|
-
let(:test_line_number) { 8 }
|
28
|
-
let(:appmap_json) { File.join(tmpdir, 'appmap/rspec/Api_UsersController_POST_api_users_with_required_parameters_creates_a_user.appmap.json') }
|
29
|
-
|
30
|
-
xcontext 'using Sequel ORM' do
|
31
|
-
let(:orm_module) { 'sequel' }
|
32
|
-
it 'detects the sql INSERT' do
|
33
|
-
expect(appmap).to include(<<-SQL_QUERY.strip)
|
34
|
-
sql_query:
|
35
|
-
sql: INSERT INTO "users" ("login") VALUES ('alice') RETURNING *
|
36
|
-
SQL_QUERY
|
37
|
-
end
|
38
|
-
end
|
39
|
-
context 'using ActiveRecord ORM' do
|
40
|
-
let(:orm_module) { 'activerecord' }
|
41
|
-
it 'detects the sql INSERT' do
|
42
|
-
expect(appmap).to include(<<-SQL_QUERY.strip)
|
43
|
-
sql_query:
|
44
|
-
sql: INSERT INTO "users" ("login", "created_at", "updated_at") VALUES ($1, $2,
|
45
|
-
$3) RETURNING "id"
|
46
|
-
SQL_QUERY
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'while listing records' do
|
52
|
-
let(:test_line_number) { 23 }
|
53
|
-
let(:appmap_json) { File.join(tmpdir, 'appmap/rspec/Api_UsersController_GET_api_users_lists_the_users.appmap.json') }
|
54
|
-
|
55
|
-
xcontext 'using Sequel ORM' do
|
56
|
-
let(:orm_module) { 'sequel' }
|
57
|
-
it 'detects the sql SELECT' do
|
58
|
-
expect(appmap).to include(<<-SQL_QUERY.strip)
|
59
|
-
sql_query:
|
60
|
-
sql: SELECT * FROM "users"
|
61
|
-
SQL_QUERY
|
62
|
-
|
63
|
-
expect(appmap).to include('sql:')
|
64
|
-
end
|
65
|
-
end
|
66
|
-
context 'using ActiveRecord ORM' do
|
67
|
-
let(:orm_module) { 'activerecord' }
|
68
|
-
it 'detects the sql SELECT' do
|
69
|
-
expect(appmap).to include(<<-SQL_QUERY.strip)
|
70
|
-
sql_query:
|
71
|
-
sql: SELECT "users".* FROM "users"
|
72
|
-
SQL_QUERY
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|