appmap 0.38.1 → 0.41.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -1
- data/.travis.yml +2 -23
- data/CHANGELOG.md +26 -1
- data/CONTRIBUTING.md +22 -0
- data/README.md +119 -53
- data/Rakefile +3 -3
- data/lib/appmap/class_map.rb +25 -8
- data/lib/appmap/config.rb +41 -21
- data/lib/appmap/event.rb +14 -4
- data/lib/appmap/hook.rb +18 -3
- data/lib/appmap/rails/request_handler.rb +17 -3
- data/lib/appmap/railtie.rb +1 -5
- data/lib/appmap/version.rb +2 -2
- data/spec/abstract_controller_base_spec.rb +116 -86
- data/spec/config_spec.rb +1 -0
- data/spec/fixtures/hook/exclude.rb +15 -0
- data/spec/fixtures/hook/labels.rb +6 -0
- data/spec/fixtures/rails5_users_app/Gemfile +2 -3
- data/spec/fixtures/rails5_users_app/app/controllers/users_controller.rb +8 -0
- data/spec/fixtures/rails5_users_app/appmap.yml +4 -1
- data/spec/fixtures/rails5_users_app/config/application.rb +2 -0
- data/spec/fixtures/rails5_users_app/config/routes.rb +1 -1
- data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_spec.rb +11 -0
- data/spec/fixtures/rails6_users_app/Gemfile +2 -3
- data/spec/fixtures/rails6_users_app/app/controllers/users_controller.rb +8 -0
- data/spec/fixtures/rails6_users_app/appmap.yml +4 -1
- data/spec/fixtures/rails6_users_app/config/application.rb +2 -0
- data/spec/fixtures/rails6_users_app/config/routes.rb +1 -1
- data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_spec.rb +11 -0
- data/spec/hook_spec.rb +41 -41
- data/spec/rails_spec_helper.rb +2 -2
- data/spec/record_sql_rails_pg_spec.rb +1 -1
- data/spec/rspec_feature_metadata_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/test/fixtures/gem_test/appmap.yml +1 -1
- data/test/fixtures/gem_test/test/parser_test.rb +12 -0
- data/test/gem_test.rb +4 -4
- metadata +6 -69
- data/spec/abstract_controller4_base_spec.rb +0 -66
- data/spec/fixtures/rails4_users_app/.gitignore +0 -13
- 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/Dockerfile +0 -30
- data/spec/fixtures/rails4_users_app/Dockerfile.pg +0 -3
- 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/Rakefile +0 -6
- data/spec/fixtures/rails4_users_app/app/assets/images/.keep +0 -0
- 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/api/users_controller.rb +0 -27
- data/spec/fixtures/rails4_users_app/app/controllers/application_controller.rb +0 -5
- data/spec/fixtures/rails4_users_app/app/controllers/concerns/.keep +0 -0
- data/spec/fixtures/rails4_users_app/app/controllers/health_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/app/mailers/.keep +0 -0
- data/spec/fixtures/rails4_users_app/app/models/.keep +0 -0
- data/spec/fixtures/rails4_users_app/app/models/concerns/.keep +0 -0
- data/spec/fixtures/rails4_users_app/app/models/user.rb +0 -18
- data/spec/fixtures/rails4_users_app/app/views/layouts/application.html.haml +0 -7
- data/spec/fixtures/rails4_users_app/app/views/users/index.html.haml +0 -7
- 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.ru +0 -4
- 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/database.yml +0 -18
- data/spec/fixtures/rails4_users_app/config/environment.rb +0 -5
- data/spec/fixtures/rails4_users_app/config/environments/development.rb +0 -41
- data/spec/fixtures/rails4_users_app/config/environments/production.rb +0 -79
- data/spec/fixtures/rails4_users_app/config/environments/test.rb +0 -42
- data/spec/fixtures/rails4_users_app/config/initializers/assets.rb +0 -11
- data/spec/fixtures/rails4_users_app/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/fixtures/rails4_users_app/config/initializers/cookies_serializer.rb +0 -3
- data/spec/fixtures/rails4_users_app/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/fixtures/rails4_users_app/config/initializers/inflections.rb +0 -16
- data/spec/fixtures/rails4_users_app/config/initializers/mime_types.rb +0 -4
- 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/initializers/wrap_parameters.rb +0 -14
- data/spec/fixtures/rails4_users_app/config/locales/en.yml +0 -23
- data/spec/fixtures/rails4_users_app/config/routes.rb +0 -12
- data/spec/fixtures/rails4_users_app/config/secrets.yml +0 -22
- data/spec/fixtures/rails4_users_app/create_app +0 -23
- 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/docker-compose.yml +0 -26
- data/spec/fixtures/rails4_users_app/lib/assets/.keep +0 -0
- data/spec/fixtures/rails4_users_app/lib/tasks/.keep +0 -0
- data/spec/fixtures/rails4_users_app/log/.keep +0 -0
- 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/spec/rails_helper.rb +0 -95
- data/spec/fixtures/rails4_users_app/spec/spec_helper.rb +0 -96
- data/spec/fixtures/rails4_users_app/test/fixtures/users.yml +0 -9
- data/spec/record_sql_rails4_pg_spec.rb +0 -75
- data/test/fixtures/gem_test/test/to_param_test.rb +0 -14
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'rails_spec_helper'
|
2
|
-
|
3
|
-
describe 'Record SQL queries in a Rails4 app' do
|
4
|
-
include_context 'Rails app pg database', 'spec/fixtures/rails4_users_app' do
|
5
|
-
around(:each) do |example|
|
6
|
-
FileUtils.rm_rf tmpdir
|
7
|
-
FileUtils.mkdir_p tmpdir
|
8
|
-
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}"
|
9
|
-
run_cmd cmd, chdir: fixture_dir
|
10
|
-
|
11
|
-
example.run
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:tmpdir) { "tmp/spec/record_sql_rails_pg_spec" }
|
15
|
-
let(:appmap) { JSON.parse(File.read(appmap_json)).to_yaml }
|
16
|
-
|
17
|
-
context 'when running specs' do
|
18
|
-
let(:test_line_number) { 31 }
|
19
|
-
let(:orm_module) { 'activerecord' }
|
20
|
-
|
21
|
-
it { is_expected.to be }
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'while creating a new record' do
|
25
|
-
let(:test_line_number) { 8 }
|
26
|
-
let(:appmap_json) { File.join(tmpdir, 'appmap/rspec/Api_UsersController_POST_api_users_with_required_parameters_creates_a_user.appmap.json') }
|
27
|
-
|
28
|
-
xcontext 'using Sequel ORM' do
|
29
|
-
let(:orm_module) { 'sequel' }
|
30
|
-
it 'detects the sql INSERT' do
|
31
|
-
expect(appmap).to include(<<-SQL_QUERY.strip)
|
32
|
-
sql_query:
|
33
|
-
sql: INSERT INTO "users" ("login") VALUES ('alice') RETURNING *
|
34
|
-
SQL_QUERY
|
35
|
-
end
|
36
|
-
end
|
37
|
-
context 'using ActiveRecord ORM' do
|
38
|
-
let(:orm_module) { 'activerecord' }
|
39
|
-
it 'detects the sql INSERT' do
|
40
|
-
expect(appmap).to include(<<-SQL_QUERY.strip)
|
41
|
-
sql_query:
|
42
|
-
sql: INSERT INTO "users" ("login", "created_at", "updated_at") VALUES ($1, $2,
|
43
|
-
$3) RETURNING "id"
|
44
|
-
SQL_QUERY
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'while listing records' do
|
50
|
-
let(:test_line_number) { 23 }
|
51
|
-
let(:appmap_json) { File.join(tmpdir, 'appmap/rspec/Api_UsersController_GET_api_users_lists_the_users.appmap.json') }
|
52
|
-
|
53
|
-
xcontext 'using Sequel ORM' do
|
54
|
-
let(:orm_module) { 'sequel' }
|
55
|
-
it 'detects the sql SELECT' do
|
56
|
-
expect(appmap).to include(<<-SQL_QUERY.strip)
|
57
|
-
sql_query:
|
58
|
-
sql: SELECT * FROM "users"
|
59
|
-
SQL_QUERY
|
60
|
-
|
61
|
-
expect(appmap).to include('sql:')
|
62
|
-
end
|
63
|
-
end
|
64
|
-
context 'using ActiveRecord ORM' do
|
65
|
-
let(:orm_module) { 'activerecord' }
|
66
|
-
it 'detects the sql SELECT' do
|
67
|
-
expect(appmap).to include(<<-SQL_QUERY.strip)
|
68
|
-
sql_query:
|
69
|
-
sql: SELECT "users".* FROM "users"
|
70
|
-
SQL_QUERY
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'appmap/minitest'
|
5
|
-
require 'minitest/autorun'
|
6
|
-
require 'active_support'
|
7
|
-
require 'active_support/core_ext'
|
8
|
-
|
9
|
-
class ToParamTest < ::Minitest::Test
|
10
|
-
def test_to_param
|
11
|
-
# record use of a core extension
|
12
|
-
assert_equal 'my+id', 'my+id'.to_param
|
13
|
-
end
|
14
|
-
end
|