appmap 0.35.0 → 0.37.2
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/.gitignore +2 -1
- data/.rubocop.yml +10 -0
- data/CHANGELOG.md +22 -0
- data/README.md +11 -8
- data/Rakefile +3 -2
- data/appmap.gemspec +2 -1
- data/appmap.yml +1 -7
- data/lib/appmap.rb +2 -2
- data/lib/appmap/class_map.rb +20 -6
- data/lib/appmap/config.rb +53 -23
- data/lib/appmap/event.rb +21 -6
- data/lib/appmap/hook.rb +1 -1
- data/lib/appmap/rails/request_handler.rb +8 -1
- data/lib/appmap/railtie.rb +1 -1
- data/lib/appmap/rspec.rb +1 -1
- data/lib/appmap/version.rb +2 -2
- data/spec/abstract_controller4_base_spec.rb +27 -28
- data/spec/abstract_controller_base_spec.rb +43 -39
- data/spec/class_map_spec.rb +36 -0
- data/spec/fixtures/hook/exception_method.rb +44 -0
- data/spec/fixtures/hook/instance_method.rb +4 -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/{.ruby-version → spec/fixtures/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 +51 -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/{rails_users_app → 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/{rails_users_app → rails5_users_app}/app/controllers/users_controller.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/models/activerecord/user.rb +0 -0
- data/spec/fixtures/{rails_users_app → 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/{rails_users_app → rails5_users_app}/app/views/layouts/application.html.haml +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/views/users/index.html.haml +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/appmap.yml +1 -1
- 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 +0 -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/{rails_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/{rails_users_app → rails5_users_app}/config/initializers/filter_parameter_logging.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/inflections.rb +0 -0
- data/spec/fixtures/{rails_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/{rails_users_app → rails5_users_app}/config/routes.rb +0 -0
- 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/{rails_users_app → rails5_users_app}/lib/tasks/.keep +0 -0
- data/spec/fixtures/{rails_users_app → 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 +0 -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/{rails_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/{rails_users_app → rails6_users_app}/.ruby-version +0 -0
- data/spec/fixtures/rails6_users_app/Dockerfile +29 -0
- data/spec/fixtures/rails6_users_app/Dockerfile.pg +3 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/Gemfile +0 -0
- data/spec/fixtures/rails6_users_app/Rakefile +6 -0
- data/spec/fixtures/rails6_users_app/app/controllers/api/users_controller.rb +27 -0
- data/spec/fixtures/rails6_users_app/app/controllers/application_controller.rb +2 -0
- data/spec/fixtures/rails6_users_app/app/controllers/concerns/.keep +0 -0
- data/spec/fixtures/rails6_users_app/app/controllers/health_controller.rb +5 -0
- data/spec/fixtures/rails6_users_app/app/controllers/users_controller.rb +5 -0
- data/spec/fixtures/rails6_users_app/app/models/activerecord/user.rb +18 -0
- data/spec/fixtures/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/rails6_users_app/app/views/layouts/application.html.haml +7 -0
- data/spec/fixtures/rails6_users_app/app/views/users/index.html.haml +7 -0
- data/spec/fixtures/rails6_users_app/appmap.yml +3 -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/rails6_users_app/config.ru +5 -0
- data/spec/fixtures/rails6_users_app/config/application.rb +51 -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/rails6_users_app/config/database.yml +18 -0
- data/spec/fixtures/rails6_users_app/config/environment.rb +5 -0
- data/spec/fixtures/rails6_users_app/config/environments/development.rb +40 -0
- data/spec/fixtures/rails6_users_app/config/environments/production.rb +68 -0
- data/spec/fixtures/rails6_users_app/config/environments/test.rb +36 -0
- data/spec/fixtures/rails6_users_app/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/fixtures/rails6_users_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails6_users_app/config/initializers/cors.rb +16 -0
- data/spec/fixtures/rails6_users_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/fixtures/rails6_users_app/config/initializers/inflections.rb +16 -0
- data/spec/fixtures/rails6_users_app/config/initializers/mime_types.rb +4 -0
- data/spec/fixtures/rails6_users_app/config/initializers/record_button.rb +3 -0
- data/spec/fixtures/rails6_users_app/config/initializers/wrap_parameters.rb +9 -0
- data/spec/fixtures/rails6_users_app/config/locales/en.yml +33 -0
- data/spec/fixtures/rails6_users_app/config/routes.rb +11 -0
- data/spec/fixtures/rails6_users_app/create_app +27 -0
- 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/rails6_users_app/docker-compose.yml +28 -0
- 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/rails6_users_app/lib/tasks/.keep +0 -0
- data/spec/fixtures/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/models/user_spec.rb +39 -0
- data/spec/fixtures/rails6_users_app/spec/rails_helper.rb +66 -0
- data/spec/fixtures/rails6_users_app/spec/spec_helper.rb +96 -0
- data/spec/fixtures/rails6_users_app/users_app/.gitignore +20 -0
- data/spec/hook_spec.rb +196 -11
- data/spec/rails_spec_helper.rb +5 -5
- data/spec/railtie_spec.rb +31 -32
- data/spec/record_sql_rails4_pg_spec.rb +47 -48
- 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/test/cli_test.rb +0 -10
- data/test/expectations/openssl_test_key_sign1.json +55 -0
- data/test/expectations/openssl_test_key_sign2.json +58 -0
- data/test/fixtures/gem_test/Gemfile +6 -0
- data/test/fixtures/gem_test/appmap.yml +3 -0
- data/test/fixtures/gem_test/test/to_param_test.rb +14 -0
- data/test/gem_test.rb +34 -0
- data/test/minitest_test.rb +2 -2
- data/test/openssl_test.rb +10 -165
- metadata +171 -80
@@ -0,0 +1,66 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
require 'spec_helper'
|
3
|
+
ENV['RAILS_ENV'] ||= 'test'
|
4
|
+
require File.expand_path('../../config/environment', __FILE__)
|
5
|
+
# Prevent database truncation if the environment is production
|
6
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
7
|
+
require 'rspec/rails'
|
8
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
9
|
+
|
10
|
+
require 'appmap/rspec'
|
11
|
+
|
12
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
13
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
14
|
+
# run as spec files by default. This means that files in spec/support that end
|
15
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
16
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
17
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
18
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
19
|
+
#
|
20
|
+
# The following line is provided for convenience purposes. It has the downside
|
21
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
22
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
23
|
+
# require only the support files necessary.
|
24
|
+
#
|
25
|
+
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
|
26
|
+
|
27
|
+
RSpec.configure do |config|
|
28
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
29
|
+
# based on their file location, for example enabling you to call `get` and
|
30
|
+
# `post` in specs under `spec/controllers`.
|
31
|
+
#
|
32
|
+
# You can disable this behaviour by removing the line below, and instead
|
33
|
+
# explicitly tag your specs with their type, e.g.:
|
34
|
+
#
|
35
|
+
# RSpec.describe UsersController, :type => :controller do
|
36
|
+
# # ...
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# The different available types are documented in the features, such as in
|
40
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
41
|
+
config.infer_spec_type_from_file_location!
|
42
|
+
|
43
|
+
# Filter lines from Rails gems in backtraces.
|
44
|
+
config.filter_rails_from_backtrace!
|
45
|
+
# arbitrary gems may also be filtered via:
|
46
|
+
# config.filter_gems_from_backtrace("gem name")
|
47
|
+
|
48
|
+
|
49
|
+
DatabaseCleaner.allow_remote_database_url = true
|
50
|
+
|
51
|
+
config.before(:suite) do
|
52
|
+
DatabaseCleaner.strategy = :transaction
|
53
|
+
DatabaseCleaner.clean_with(:truncation)
|
54
|
+
end
|
55
|
+
|
56
|
+
config.around :each do |example|
|
57
|
+
# Enable the use of 'return' from a guard
|
58
|
+
-> {
|
59
|
+
return example.run unless %i[model controller].member?(example.metadata[:type])
|
60
|
+
|
61
|
+
DatabaseCleaner.cleaning do
|
62
|
+
example.run
|
63
|
+
end
|
64
|
+
}.call
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
16
|
+
RSpec.configure do |config|
|
17
|
+
# rspec-expectations config goes here. You can use an alternate
|
18
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
19
|
+
# assertions if you prefer.
|
20
|
+
config.expect_with :rspec do |expectations|
|
21
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
22
|
+
# and `failure_message` of custom matchers include text for helper methods
|
23
|
+
# defined using `chain`, e.g.:
|
24
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
25
|
+
# # => "be bigger than 2 and smaller than 4"
|
26
|
+
# ...rather than:
|
27
|
+
# # => "be bigger than 2"
|
28
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
29
|
+
end
|
30
|
+
|
31
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
32
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
33
|
+
config.mock_with :rspec do |mocks|
|
34
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
35
|
+
# a real object. This is generally recommended, and will default to
|
36
|
+
# `true` in RSpec 4.
|
37
|
+
mocks.verify_partial_doubles = true
|
38
|
+
end
|
39
|
+
|
40
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
41
|
+
# have no way to turn it off -- the option exists only for backwards
|
42
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
43
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
44
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
45
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
46
|
+
|
47
|
+
# The settings below are suggested to provide a good initial experience
|
48
|
+
# with RSpec, but feel free to customize to your heart's content.
|
49
|
+
=begin
|
50
|
+
# This allows you to limit a spec run to individual examples or groups
|
51
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
52
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
53
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
54
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
55
|
+
config.filter_run_when_matching :focus
|
56
|
+
|
57
|
+
# Allows RSpec to persist some state between runs in order to support
|
58
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
59
|
+
# you configure your source control system to ignore this file.
|
60
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
61
|
+
|
62
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
63
|
+
# recommended. For more details, see:
|
64
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
65
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
66
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
67
|
+
config.disable_monkey_patching!
|
68
|
+
|
69
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
70
|
+
# file, and it's useful to allow more verbose output when running an
|
71
|
+
# individual spec file.
|
72
|
+
if config.files_to_run.one?
|
73
|
+
# Use the documentation formatter for detailed output,
|
74
|
+
# unless a formatter has already been configured
|
75
|
+
# (e.g. via a command-line flag).
|
76
|
+
config.default_formatter = "doc"
|
77
|
+
end
|
78
|
+
|
79
|
+
# Print the 10 slowest examples and example groups at the
|
80
|
+
# end of the spec run, to help surface which specs are running
|
81
|
+
# particularly slow.
|
82
|
+
config.profile_examples = 10
|
83
|
+
|
84
|
+
# Run specs in random order to surface order dependencies. If you find an
|
85
|
+
# order dependency and want to debug it, you can fix the order by providing
|
86
|
+
# the seed, which is printed after each run.
|
87
|
+
# --seed 1234
|
88
|
+
config.order = :random
|
89
|
+
|
90
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
91
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
92
|
+
# test failures related to randomization by passing the same `--seed` value
|
93
|
+
# as the one that triggered the failure.
|
94
|
+
Kernel.srand config.seed
|
95
|
+
=end
|
96
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore all logfiles and tempfiles.
|
11
|
+
/log/*
|
12
|
+
/tmp/*
|
13
|
+
!/log/.keep
|
14
|
+
!/tmp/.keep
|
15
|
+
|
16
|
+
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
# Ignore master key for decrypting credentials and more.
|
20
|
+
/config/master.key
|
data/spec/hook_spec.rb
CHANGED
@@ -27,7 +27,7 @@ describe 'AppMap class Hooking', docker: false do
|
|
27
27
|
|
28
28
|
def invoke_test_file(file, setup: nil, &block)
|
29
29
|
AppMap.configuration = nil
|
30
|
-
package = AppMap::Config::Package.
|
30
|
+
package = AppMap::Config::Package.build_from_path(file)
|
31
31
|
config = AppMap::Config.new('hook_spec', [ package ])
|
32
32
|
AppMap.configuration = config
|
33
33
|
tracer = nil
|
@@ -112,6 +112,10 @@ describe 'AppMap class Hooking', docker: false do
|
|
112
112
|
:type: function
|
113
113
|
:location: spec/fixtures/hook/instance_method.rb:8
|
114
114
|
:static: false
|
115
|
+
:source: |2
|
116
|
+
def say_default
|
117
|
+
'default'
|
118
|
+
end
|
115
119
|
YAML
|
116
120
|
end
|
117
121
|
|
@@ -177,8 +181,8 @@ describe 'AppMap class Hooking', docker: false do
|
|
177
181
|
:static: false
|
178
182
|
:parameters:
|
179
183
|
- :name: :kw
|
180
|
-
:class:
|
181
|
-
:value:
|
184
|
+
:class: String
|
185
|
+
:value: kw
|
182
186
|
:kind: :key
|
183
187
|
:receiver:
|
184
188
|
:class: InstanceMethod
|
@@ -225,6 +229,48 @@ describe 'AppMap class Hooking', docker: false do
|
|
225
229
|
end
|
226
230
|
end
|
227
231
|
|
232
|
+
it 'hooks an instance method that takes keyword arguments' do
|
233
|
+
events_yaml = <<~YAML
|
234
|
+
---
|
235
|
+
- :id: 1
|
236
|
+
:event: :call
|
237
|
+
:defined_class: InstanceMethod
|
238
|
+
:method_id: say_kws
|
239
|
+
:path: spec/fixtures/hook/instance_method.rb
|
240
|
+
:lineno: 20
|
241
|
+
:static: false
|
242
|
+
:parameters:
|
243
|
+
- :name: :args
|
244
|
+
:class: Array
|
245
|
+
:value: "[4, 5]"
|
246
|
+
:kind: :rest
|
247
|
+
- :name: :kw1
|
248
|
+
:class: String
|
249
|
+
:value: one
|
250
|
+
:kind: :keyreq
|
251
|
+
- :name: :kw2
|
252
|
+
:class: Integer
|
253
|
+
:value: '2'
|
254
|
+
:kind: :key
|
255
|
+
- :name: :kws
|
256
|
+
:class: Hash
|
257
|
+
:value: "{:kw3=>:three}"
|
258
|
+
:kind: :keyrest
|
259
|
+
:receiver:
|
260
|
+
:class: InstanceMethod
|
261
|
+
:value: Instance Method fixture
|
262
|
+
- :id: 2
|
263
|
+
:event: :return
|
264
|
+
:parent_id: 1
|
265
|
+
:return_value:
|
266
|
+
:class: String
|
267
|
+
:value: one2{:kw3=>:three}45
|
268
|
+
YAML
|
269
|
+
test_hook_behavior 'spec/fixtures/hook/instance_method.rb', events_yaml do
|
270
|
+
expect(InstanceMethod.new.say_kws(4, 5, kw1: 'one', kw2: 2, kw3: :three)).to eq('one2{:kw3=>:three}45')
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
228
274
|
it 'hooks an instance method that takes a block argument' do
|
229
275
|
events_yaml = <<~YAML
|
230
276
|
---
|
@@ -233,7 +279,7 @@ describe 'AppMap class Hooking', docker: false do
|
|
233
279
|
:defined_class: InstanceMethod
|
234
280
|
:method_id: say_block
|
235
281
|
:path: spec/fixtures/hook/instance_method.rb
|
236
|
-
:lineno:
|
282
|
+
:lineno: 24
|
237
283
|
:static: false
|
238
284
|
:parameters:
|
239
285
|
- :name: :block
|
@@ -401,7 +447,7 @@ describe 'AppMap class Hooking', docker: false do
|
|
401
447
|
|
402
448
|
# Verify the native extension works as expected
|
403
449
|
expect(AppMap::Hook.singleton_method_owner_name(say_instance_defined)).to eq('SingletonMethod')
|
404
|
-
|
450
|
+
|
405
451
|
expect(s.say_instance_defined).to eq('defined for an instance')
|
406
452
|
end
|
407
453
|
end
|
@@ -432,7 +478,7 @@ describe 'AppMap class Hooking', docker: false do
|
|
432
478
|
expect(SingletonMethod::STRUCT_TEST.say_struct_singleton).to eq('singleton for a struct')
|
433
479
|
end
|
434
480
|
end
|
435
|
-
|
481
|
+
|
436
482
|
it 'Reports exceptions' do
|
437
483
|
events_yaml = <<~YAML
|
438
484
|
---
|
@@ -465,6 +511,132 @@ describe 'AppMap class Hooking', docker: false do
|
|
465
511
|
end
|
466
512
|
end
|
467
513
|
|
514
|
+
context 'string conversions works for the receiver when' do
|
515
|
+
|
516
|
+
it 'is missing #to_s' do
|
517
|
+
events_yaml = <<~YAML
|
518
|
+
---
|
519
|
+
- :id: 1
|
520
|
+
:event: :call
|
521
|
+
:defined_class: NoToSMethod
|
522
|
+
:method_id: respond_to?
|
523
|
+
:path: spec/fixtures/hook/exception_method.rb
|
524
|
+
:lineno: 24
|
525
|
+
:static: false
|
526
|
+
:parameters:
|
527
|
+
- :name: :args
|
528
|
+
:class: Array
|
529
|
+
:value: "[:to_s]"
|
530
|
+
:kind: :rest
|
531
|
+
:receiver:
|
532
|
+
:class: Class
|
533
|
+
:value: NoToSMethod
|
534
|
+
- :id: 2
|
535
|
+
:event: :return
|
536
|
+
:parent_id: 1
|
537
|
+
- :id: 3
|
538
|
+
:event: :call
|
539
|
+
:defined_class: NoToSMethod
|
540
|
+
:method_id: say_hello
|
541
|
+
:path: spec/fixtures/hook/exception_method.rb
|
542
|
+
:lineno: 32
|
543
|
+
:static: false
|
544
|
+
:parameters: []
|
545
|
+
:receiver:
|
546
|
+
:class: Class
|
547
|
+
:value: NoToSMethod
|
548
|
+
- :id: 4
|
549
|
+
:event: :return
|
550
|
+
:parent_id: 3
|
551
|
+
:return_value:
|
552
|
+
:class: String
|
553
|
+
:value: hello
|
554
|
+
YAML
|
555
|
+
|
556
|
+
test_hook_behavior 'spec/fixtures/hook/exception_method.rb', events_yaml do
|
557
|
+
inst = NoToSMethod.new
|
558
|
+
# sanity check
|
559
|
+
expect(inst).not_to respond_to(:to_s)
|
560
|
+
inst.say_hello
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
564
|
+
it 'it is missing #to_s and it raises an exception in #inspect' do
|
565
|
+
events_yaml = <<~YAML
|
566
|
+
---
|
567
|
+
- :id: 1
|
568
|
+
:event: :call
|
569
|
+
:defined_class: NoToSMethod
|
570
|
+
:method_id: respond_to?
|
571
|
+
:path: spec/fixtures/hook/exception_method.rb
|
572
|
+
:lineno: 24
|
573
|
+
:static: false
|
574
|
+
:parameters:
|
575
|
+
- :name: :args
|
576
|
+
:class: Array
|
577
|
+
:value: "[:to_s]"
|
578
|
+
:kind: :rest
|
579
|
+
:receiver:
|
580
|
+
:class: Class
|
581
|
+
:value: "*Error inspecting variable*"
|
582
|
+
- :id: 2
|
583
|
+
:event: :return
|
584
|
+
:parent_id: 1
|
585
|
+
- :id: 3
|
586
|
+
:event: :call
|
587
|
+
:defined_class: InspectRaises
|
588
|
+
:method_id: say_hello
|
589
|
+
:path: spec/fixtures/hook/exception_method.rb
|
590
|
+
:lineno: 42
|
591
|
+
:static: false
|
592
|
+
:parameters: []
|
593
|
+
:receiver:
|
594
|
+
:class: Class
|
595
|
+
:value: "*Error inspecting variable*"
|
596
|
+
- :id: 4
|
597
|
+
:event: :return
|
598
|
+
:parent_id: 3
|
599
|
+
:return_value:
|
600
|
+
:class: String
|
601
|
+
:value: hello
|
602
|
+
YAML
|
603
|
+
|
604
|
+
test_hook_behavior 'spec/fixtures/hook/exception_method.rb', events_yaml do
|
605
|
+
inst = InspectRaises.new
|
606
|
+
# sanity check
|
607
|
+
expect(inst).not_to respond_to(:to_s)
|
608
|
+
inst.say_hello
|
609
|
+
end
|
610
|
+
end
|
611
|
+
|
612
|
+
it 'it raises an exception in #to_s' do
|
613
|
+
events_yaml = <<~YAML
|
614
|
+
---
|
615
|
+
- :id: 1
|
616
|
+
:event: :call
|
617
|
+
:defined_class: ToSRaises
|
618
|
+
:method_id: say_hello
|
619
|
+
:path: spec/fixtures/hook/exception_method.rb
|
620
|
+
:lineno: 52
|
621
|
+
:static: false
|
622
|
+
:parameters: []
|
623
|
+
:receiver:
|
624
|
+
:class: ToSRaises
|
625
|
+
:value: "*Error inspecting variable*"
|
626
|
+
- :id: 2
|
627
|
+
:event: :return
|
628
|
+
:parent_id: 1
|
629
|
+
:return_value:
|
630
|
+
:class: String
|
631
|
+
:value: hello
|
632
|
+
YAML
|
633
|
+
|
634
|
+
test_hook_behavior 'spec/fixtures/hook/exception_method.rb', events_yaml do
|
635
|
+
ToSRaises.new.say_hello
|
636
|
+
end
|
637
|
+
end
|
638
|
+
end
|
639
|
+
|
468
640
|
it 're-raises exceptions' do
|
469
641
|
RSpec::Expectations.configuration.on_potential_false_positives = :nothing
|
470
642
|
|
@@ -523,8 +695,8 @@ describe 'AppMap class Hooking', docker: false do
|
|
523
695
|
:static: false
|
524
696
|
:parameters:
|
525
697
|
- :name: arg
|
526
|
-
:class:
|
527
|
-
:value: string
|
698
|
+
:class: Array
|
699
|
+
:value: '["string"]'
|
528
700
|
:kind: :rest
|
529
701
|
:receiver:
|
530
702
|
:class: Digest::SHA256
|
@@ -543,8 +715,8 @@ describe 'AppMap class Hooking', docker: false do
|
|
543
715
|
:static: false
|
544
716
|
:parameters:
|
545
717
|
- :name: arg
|
546
|
-
:class:
|
547
|
-
:value: string
|
718
|
+
:class: Array
|
719
|
+
:value: '["string"]'
|
548
720
|
:kind: :rest
|
549
721
|
:receiver:
|
550
722
|
:class: Digest::SHA256
|
@@ -587,6 +759,10 @@ describe 'AppMap class Hooking', docker: false do
|
|
587
759
|
:type: function
|
588
760
|
:location: spec/fixtures/hook/compare.rb:4
|
589
761
|
:static: true
|
762
|
+
:source: |2
|
763
|
+
def self.compare(s1, s2)
|
764
|
+
ActiveSupport::SecurityUtils.secure_compare(s1, s2)
|
765
|
+
end
|
590
766
|
- :name: active_support
|
591
767
|
:type: package
|
592
768
|
:children:
|
@@ -603,6 +779,15 @@ describe 'AppMap class Hooking', docker: false do
|
|
603
779
|
:labels:
|
604
780
|
- security
|
605
781
|
- crypto
|
782
|
+
:comment: |
|
783
|
+
# Constant time string comparison, for variable length strings.
|
784
|
+
#
|
785
|
+
# The values are first processed by SHA256, so that we don't leak length info
|
786
|
+
# via timing attacks.
|
787
|
+
:source: |2
|
788
|
+
def secure_compare(a, b)
|
789
|
+
fixed_length_secure_compare(::Digest::SHA256.digest(a), ::Digest::SHA256.digest(b)) && a == b
|
790
|
+
end
|
606
791
|
- :name: openssl
|
607
792
|
:type: package
|
608
793
|
:children:
|
@@ -642,7 +827,7 @@ describe 'AppMap class Hooking', docker: false do
|
|
642
827
|
:defined_class: InstanceMethod
|
643
828
|
:method_id: say_the_time
|
644
829
|
:path: spec/fixtures/hook/instance_method.rb
|
645
|
-
:lineno:
|
830
|
+
:lineno: 28
|
646
831
|
:static: false
|
647
832
|
:parameters: []
|
648
833
|
:receiver:
|