appmap 0.41.2 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/appmap.rb +5 -0
- data/lib/appmap/command/record.rb +1 -1
- data/lib/appmap/middleware/remote_recording.rb +1 -1
- data/lib/appmap/minitest.rb +17 -14
- data/lib/appmap/rspec.rb +12 -78
- data/lib/appmap/version.rb +1 -1
- data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_api_spec.rb +3 -3
- data/spec/fixtures/rails5_users_app/spec/models/user_spec.rb +2 -12
- data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb +3 -3
- data/spec/fixtures/rails6_users_app/spec/models/user_spec.rb +2 -12
- data/test/fixtures/rspec_recorder/spec/decorated_hello_spec.rb +3 -3
- data/test/fixtures/rspec_recorder/spec/plain_hello_spec.rb +1 -1
- data/test/minitest_test.rb +1 -2
- data/test/rspec_test.rb +1 -7
- metadata +2 -3
- data/spec/rspec_feature_metadata_spec.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50826fcf91733d3bb29aad0b6c77af2516ad08aa87557c3675d4be896f7790db
|
4
|
+
data.tar.gz: 4e5ee3f431b68a69de5ff6b080eeae861f3f7de6fe952ea1e71b5c30d4777bc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcd01c7d1a3d70c29e33d8890e8f1ea8d7dc5cd2fbca7724618fcc76190c2d0217b89ba69e4de5003eb80147d44c15335cfdff60e67cdaf3eeaa18655fdf2b4f
|
7
|
+
data.tar.gz: 32c714968c8669f3a9dceb20543a0f09856948f4b4d6b8584ad06d6347cf10f28a4d0386e4f3af1aaccb1709ec2a88fefe88da88104ffbe18dfd0fd81fb5cb95
|
data/CHANGELOG.md
CHANGED
data/lib/appmap.rb
CHANGED
@@ -50,6 +50,11 @@ module AppMap
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
# Whether to include source and comments in all class maps.
|
54
|
+
def include_source?
|
55
|
+
ENV['APPMAP_SOURCE'] == 'true'
|
56
|
+
end
|
57
|
+
|
53
58
|
# Used to start tracing, stop tracing, and record events.
|
54
59
|
def tracing
|
55
60
|
@tracing ||= Trace::Tracing.new
|
@@ -67,7 +67,7 @@ module AppMap
|
|
67
67
|
|
68
68
|
response = JSON.generate \
|
69
69
|
version: AppMap::APPMAP_FORMAT_VERSION,
|
70
|
-
classMap: AppMap.class_map(tracer.event_methods),
|
70
|
+
classMap: AppMap.class_map(tracer.event_methods, include_source: AppMap.include_source?),
|
71
71
|
metadata: metadata,
|
72
72
|
events: @events
|
73
73
|
|
data/lib/appmap/minitest.rb
CHANGED
@@ -7,20 +7,25 @@ module AppMap
|
|
7
7
|
# be activated around each test.
|
8
8
|
module Minitest
|
9
9
|
APPMAP_OUTPUT_DIR = 'tmp/appmap/minitest'
|
10
|
-
LOG =
|
10
|
+
LOG = ( ENV['APPMAP_DEBUG'] == 'true' || ENV['DEBUG'] == 'true' )
|
11
11
|
|
12
12
|
def self.metadata
|
13
13
|
AppMap.detect_metadata
|
14
14
|
end
|
15
15
|
|
16
|
-
Recording = Struct.new(:test) do
|
17
|
-
def initialize(test)
|
16
|
+
Recording = Struct.new(:test, :test_name) do
|
17
|
+
def initialize(test, test_name)
|
18
18
|
super
|
19
19
|
|
20
|
-
warn "Starting recording of test #{test.class}.#{test.name}" if AppMap::Minitest::LOG
|
20
|
+
warn "Starting recording of test #{test.class}.#{test.name}@#{source_location}" if AppMap::Minitest::LOG
|
21
21
|
@trace = AppMap.tracing.trace
|
22
22
|
end
|
23
23
|
|
24
|
+
def source_location
|
25
|
+
test.method(test_name).source_location.join(':')
|
26
|
+
end
|
27
|
+
|
28
|
+
|
24
29
|
def finish
|
25
30
|
warn "Finishing recording of test #{test.class}.#{test.name}" if AppMap::Minitest::LOG
|
26
31
|
|
@@ -31,7 +36,7 @@ module AppMap
|
|
31
36
|
|
32
37
|
AppMap::Minitest.add_event_methods @trace.event_methods
|
33
38
|
|
34
|
-
class_map = AppMap.class_map(@trace.event_methods)
|
39
|
+
class_map = AppMap.class_map(@trace.event_methods, include_source: AppMap.include_source?)
|
35
40
|
|
36
41
|
feature_group = test.class.name.underscore.split('_')[0...-1].join('_').capitalize
|
37
42
|
feature_name = test.name.split('_')[1..-1].join(' ')
|
@@ -39,9 +44,8 @@ module AppMap
|
|
39
44
|
|
40
45
|
AppMap::Minitest.save scenario_name,
|
41
46
|
class_map,
|
42
|
-
|
43
|
-
|
44
|
-
feature_group_name: feature_group
|
47
|
+
source_location,
|
48
|
+
events: events
|
45
49
|
end
|
46
50
|
end
|
47
51
|
|
@@ -55,8 +59,8 @@ module AppMap
|
|
55
59
|
FileUtils.mkdir_p APPMAP_OUTPUT_DIR
|
56
60
|
end
|
57
61
|
|
58
|
-
def begin_test(test)
|
59
|
-
@recordings_by_test[test.object_id] = Recording.new(test)
|
62
|
+
def begin_test(test, name)
|
63
|
+
@recordings_by_test[test.object_id] = Recording.new(test, name)
|
60
64
|
end
|
61
65
|
|
62
66
|
def end_test(test)
|
@@ -74,12 +78,11 @@ module AppMap
|
|
74
78
|
@event_methods += event_methods
|
75
79
|
end
|
76
80
|
|
77
|
-
def save(example_name, class_map,
|
81
|
+
def save(example_name, class_map, source_location, events: nil, labels: nil)
|
78
82
|
metadata = AppMap::Minitest.metadata.tap do |m|
|
79
83
|
m[:name] = example_name
|
84
|
+
m[:source_location] = source_location
|
80
85
|
m[:app] = AppMap.configuration.name
|
81
|
-
m[:feature] = feature_name if feature_name
|
82
|
-
m[:feature_group] = feature_group_name if feature_group_name
|
83
86
|
m[:frameworks] ||= []
|
84
87
|
m[:frameworks] << {
|
85
88
|
name: 'minitest',
|
@@ -128,7 +131,7 @@ if AppMap::Minitest.enabled?
|
|
128
131
|
alias run_without_hook run
|
129
132
|
|
130
133
|
def run
|
131
|
-
AppMap::Minitest.begin_test self
|
134
|
+
AppMap::Minitest.begin_test self, name
|
132
135
|
begin
|
133
136
|
run_without_hook
|
134
137
|
ensure
|
data/lib/appmap/rspec.rb
CHANGED
@@ -13,58 +13,9 @@ module AppMap
|
|
13
13
|
AppMap.detect_metadata
|
14
14
|
end
|
15
15
|
|
16
|
-
module FeatureAnnotations
|
17
|
-
def feature
|
18
|
-
return nil unless annotations
|
19
|
-
|
20
|
-
annotations[:feature]
|
21
|
-
end
|
22
|
-
|
23
|
-
def labels
|
24
|
-
labels = metadata[:appmap]
|
25
|
-
if labels.is_a?(Array)
|
26
|
-
labels
|
27
|
-
elsif labels.is_a?(String) || labels.is_a?(Symbol)
|
28
|
-
[ labels ]
|
29
|
-
else
|
30
|
-
[]
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def feature_group
|
35
|
-
return nil unless annotations
|
36
|
-
|
37
|
-
annotations[:feature_group]
|
38
|
-
end
|
39
|
-
|
40
|
-
def annotations
|
41
|
-
metadata.tap do |md|
|
42
|
-
description_args_hashes.each do |h|
|
43
|
-
md.merge! h
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
protected
|
49
|
-
|
50
|
-
def metadata
|
51
|
-
return {} unless example_obj.respond_to?(:metadata)
|
52
|
-
|
53
|
-
example_obj.metadata
|
54
|
-
end
|
55
|
-
|
56
|
-
def description_args_hashes
|
57
|
-
return [] unless example_obj.respond_to?(:metadata)
|
58
|
-
|
59
|
-
(example_obj.metadata[:description_args] || []).select { |arg| arg.is_a?(Hash) }
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
16
|
# ScopeExample and ScopeExampleGroup is a way to handle the weird way that RSpec
|
64
17
|
# stores the nested example names.
|
65
18
|
ScopeExample = Struct.new(:example) do
|
66
|
-
include FeatureAnnotations
|
67
|
-
|
68
19
|
alias_method :example_obj, :example
|
69
20
|
|
70
21
|
def description?
|
@@ -83,8 +34,6 @@ module AppMap
|
|
83
34
|
# As you can see here, the way that RSpec stores the example description and
|
84
35
|
# represents the example group hierarchy is pretty weird.
|
85
36
|
ScopeExampleGroup = Struct.new(:example_group) do
|
86
|
-
include FeatureAnnotations
|
87
|
-
|
88
37
|
alias_method :example_obj, :example_group
|
89
38
|
|
90
39
|
def description_args
|
@@ -133,11 +82,17 @@ module AppMap
|
|
133
82
|
page.driver.options[:http_client].instance_variable_get('@server_url').port
|
134
83
|
end
|
135
84
|
|
136
|
-
warn "Starting recording of example #{example}" if AppMap::RSpec::LOG
|
85
|
+
warn "Starting recording of example #{example}@#{source_location}" if AppMap::RSpec::LOG
|
137
86
|
@trace = AppMap.tracing.trace
|
138
87
|
@webdriver_port = webdriver_port.()
|
139
88
|
end
|
140
89
|
|
90
|
+
def source_location
|
91
|
+
result = example.location_rerun_argument.split(':')[0]
|
92
|
+
result = result[2..-1] if result.index('./') == 0
|
93
|
+
result
|
94
|
+
end
|
95
|
+
|
141
96
|
def finish
|
142
97
|
warn "Finishing recording of example #{example}" if AppMap::RSpec::LOG
|
143
98
|
|
@@ -148,22 +103,16 @@ module AppMap
|
|
148
103
|
|
149
104
|
AppMap::RSpec.add_event_methods @trace.event_methods
|
150
105
|
|
151
|
-
class_map = AppMap.class_map(@trace.event_methods, include_source:
|
106
|
+
class_map = AppMap.class_map(@trace.event_methods, include_source: AppMap.include_source?)
|
152
107
|
|
153
108
|
description = []
|
154
109
|
scope = ScopeExample.new(example)
|
155
|
-
feature_group = feature = nil
|
156
110
|
|
157
|
-
labels = []
|
158
111
|
while scope
|
159
|
-
labels += scope.labels
|
160
112
|
description << scope.description
|
161
|
-
feature ||= scope.feature
|
162
|
-
feature_group ||= scope.feature_group
|
163
113
|
scope = scope.parent
|
164
114
|
end
|
165
115
|
|
166
|
-
labels = labels.map(&:to_s).map(&:strip).reject(&:blank?).map(&:downcase).uniq
|
167
116
|
description.reject!(&:nil?).reject!(&:blank?)
|
168
117
|
default_description = description.last
|
169
118
|
description.reverse!
|
@@ -177,24 +126,10 @@ module AppMap
|
|
177
126
|
|
178
127
|
full_description = normalize.call(description.join(' '))
|
179
128
|
|
180
|
-
compute_feature_name = lambda do
|
181
|
-
return 'unknown' if description.empty?
|
182
|
-
|
183
|
-
feature_description = description.dup
|
184
|
-
num_tokens = [2, feature_description.length - 1].min
|
185
|
-
feature_description[0...num_tokens].map(&:strip).join(' ')
|
186
|
-
end
|
187
|
-
|
188
|
-
feature_group ||= normalize.call(default_description).underscore.gsub('/', '_').humanize
|
189
|
-
feature_name = feature || compute_feature_name.call if feature_group
|
190
|
-
feature_name = normalize.call(feature_name) if feature_name
|
191
|
-
|
192
129
|
AppMap::RSpec.save full_description,
|
193
130
|
class_map,
|
194
|
-
|
195
|
-
|
196
|
-
feature_group_name: feature_group,
|
197
|
-
labels: labels.blank? ? nil : labels
|
131
|
+
source_location,
|
132
|
+
events: events
|
198
133
|
end
|
199
134
|
end
|
200
135
|
|
@@ -227,12 +162,11 @@ module AppMap
|
|
227
162
|
@event_methods += event_methods
|
228
163
|
end
|
229
164
|
|
230
|
-
def save(example_name, class_map,
|
165
|
+
def save(example_name, class_map, source_location, events: nil, labels: nil)
|
231
166
|
metadata = AppMap::RSpec.metadata.tap do |m|
|
232
167
|
m[:name] = example_name
|
168
|
+
m[:source_location] = source_location
|
233
169
|
m[:app] = AppMap.configuration.name
|
234
|
-
m[:feature] = feature_name if feature_name
|
235
|
-
m[:feature_group] = feature_group_name if feature_group_name
|
236
170
|
m[:labels] = labels if labels
|
237
171
|
m[:frameworks] ||= []
|
238
172
|
m[:frameworks] << {
|
data/lib/appmap/version.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
require 'rack/test'
|
3
3
|
|
4
|
-
RSpec.describe Api::UsersController,
|
5
|
-
describe 'POST /api/users'
|
4
|
+
RSpec.describe Api::UsersController, type: :controller do
|
5
|
+
describe 'POST /api/users' do
|
6
6
|
describe 'with required parameters' do
|
7
7
|
it 'creates a user' do
|
8
8
|
post :create, params: { login: 'alice', password: 'foobar' }
|
@@ -16,7 +16,7 @@ RSpec.describe Api::UsersController, feature_group: 'Users', type: :controller,
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
|
-
describe 'GET /api/users'
|
19
|
+
describe 'GET /api/users' do
|
20
20
|
before do
|
21
21
|
post :create, params: { login: 'alice' }
|
22
22
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe User
|
3
|
+
describe User do
|
4
4
|
# TODO: appmap/rspec doesn't handle shared_examples_for 100% correctly yet.
|
5
5
|
# In my tests, only one of these two tests will be emitted as an appmap.
|
6
6
|
shared_examples_for 'creates the user' do |username|
|
@@ -11,17 +11,7 @@ describe User, feature_group: 'User', appmap: true do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
describe 'creation'
|
15
|
-
context 'using shared_examples_for' do
|
16
|
-
# AppMap.
|
17
|
-
# context "with username 'alice'" do
|
18
|
-
# it_should_behave_like 'creates the user', 'alice'
|
19
|
-
# end
|
20
|
-
# context "with username 'bob'" do
|
21
|
-
# it_should_behave_like 'creates the user', 'bob'
|
22
|
-
# end
|
23
|
-
end
|
24
|
-
|
14
|
+
describe 'creation' do
|
25
15
|
# So, instead of shared_examples_for, let's go with a simple method
|
26
16
|
# containing the assertions. The method can be called from within an example.
|
27
17
|
def save_and_verify
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
require 'rack/test'
|
3
3
|
|
4
|
-
RSpec.describe Api::UsersController,
|
5
|
-
describe 'POST /api/users'
|
4
|
+
RSpec.describe Api::UsersController, type: :controller do
|
5
|
+
describe 'POST /api/users' do
|
6
6
|
describe 'with required parameters' do
|
7
7
|
it 'creates a user' do
|
8
8
|
post :create, params: { login: 'alice', password: 'foobar' }
|
@@ -16,7 +16,7 @@ RSpec.describe Api::UsersController, feature_group: 'Users', type: :controller,
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
|
-
describe 'GET /api/users'
|
19
|
+
describe 'GET /api/users' do
|
20
20
|
before do
|
21
21
|
post :create, params: { login: 'alice' }
|
22
22
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe User
|
3
|
+
describe User do
|
4
4
|
# TODO: appmap/rspec doesn't handle shared_examples_for 100% correctly yet.
|
5
5
|
# In my tests, only one of these two tests will be emitted as an appmap.
|
6
6
|
shared_examples_for 'creates the user' do |username|
|
@@ -11,17 +11,7 @@ describe User, feature_group: 'User', appmap: true do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
describe 'creation'
|
15
|
-
context 'using shared_examples_for' do
|
16
|
-
# AppMap.
|
17
|
-
# context "with username 'alice'" do
|
18
|
-
# it_should_behave_like 'creates the user', 'alice'
|
19
|
-
# end
|
20
|
-
# context "with username 'bob'" do
|
21
|
-
# it_should_behave_like 'creates the user', 'bob'
|
22
|
-
# end
|
23
|
-
end
|
24
|
-
|
14
|
+
describe 'creation' do
|
25
15
|
# So, instead of shared_examples_for, let's go with a simple method
|
26
16
|
# containing the assertions. The method can be called from within an example.
|
27
17
|
def save_and_verify
|
@@ -2,7 +2,7 @@ require 'rspec'
|
|
2
2
|
require 'appmap/rspec'
|
3
3
|
require 'hello'
|
4
4
|
|
5
|
-
describe Hello
|
5
|
+
describe Hello do
|
6
6
|
before do
|
7
7
|
# Trick appmap-ruby into thinking we're a Rails app.
|
8
8
|
stub_const('Rails', double('rails', version: 'fake.0'))
|
@@ -11,11 +11,11 @@ describe Hello, feature_group: 'Saying hello' do
|
|
11
11
|
# The order of these examples is important. The tests check the
|
12
12
|
# appmap for 'says hello', and we want another example to get run
|
13
13
|
# before it.
|
14
|
-
it 'does not say goodbye'
|
14
|
+
it 'does not say goodbye' do
|
15
15
|
expect(Hello.new.say_hello).not_to eq('Goodbye!')
|
16
16
|
end
|
17
17
|
|
18
|
-
it 'says hello'
|
18
|
+
it 'says hello' do
|
19
19
|
expect(Hello.new.say_hello).to eq('Hello!')
|
20
20
|
end
|
21
21
|
end
|
data/test/minitest_test.rb
CHANGED
@@ -30,9 +30,8 @@ class MinitestTest < Minitest::Test
|
|
30
30
|
assert_equal 'minitest_recorder', metadata['app']
|
31
31
|
assert_equal 'minitest', metadata['recorder']['name']
|
32
32
|
assert_equal 'ruby', metadata['language']['name']
|
33
|
-
assert_equal 'Hello', metadata['feature_group']
|
34
|
-
assert_equal 'hello', metadata['feature']
|
35
33
|
assert_equal 'Hello hello', metadata['name']
|
34
|
+
assert_equal 'test/hello_test.rb:9', metadata['source_location']
|
36
35
|
end
|
37
36
|
end
|
38
37
|
end
|
data/test/rspec_test.rb
CHANGED
@@ -28,8 +28,6 @@ class RSpecTest < Minitest::Test
|
|
28
28
|
assert_includes appmap.keys, 'metadata'
|
29
29
|
metadata = appmap['metadata']
|
30
30
|
assert_equal 'Inventory', metadata['name']
|
31
|
-
assert_includes metadata.keys, 'labels'
|
32
|
-
assert_equal metadata['labels'], %w[inventory]
|
33
31
|
end
|
34
32
|
end
|
35
33
|
|
@@ -42,9 +40,8 @@ class RSpecTest < Minitest::Test
|
|
42
40
|
assert_equal AppMap::APPMAP_FORMAT_VERSION, appmap['version']
|
43
41
|
assert_includes appmap.keys, 'metadata'
|
44
42
|
metadata = appmap['metadata']
|
45
|
-
assert_equal 'Saying hello', metadata['feature_group']
|
46
|
-
assert_equal 'Speak hello', metadata['feature']
|
47
43
|
assert_equal 'Hello says hello', metadata['name']
|
44
|
+
assert_equal 'spec/decorated_hello_spec.rb', metadata['source_location']
|
48
45
|
assert_includes metadata.keys, 'client'
|
49
46
|
assert_equal({ name: 'appmap', url: AppMap::URL, version: AppMap::VERSION }.stringify_keys, metadata['client'])
|
50
47
|
assert_includes metadata.keys, 'recorder'
|
@@ -63,8 +60,6 @@ class RSpecTest < Minitest::Test
|
|
63
60
|
appmap = JSON.parse(File.read(appmap_file))
|
64
61
|
assert_includes appmap.keys, 'metadata'
|
65
62
|
metadata = appmap['metadata']
|
66
|
-
assert_equal 'Hello', metadata['feature_group']
|
67
|
-
assert_equal 'Hello', metadata['feature']
|
68
63
|
assert_equal 'Hello says hello', metadata['name']
|
69
64
|
end
|
70
65
|
end
|
@@ -76,7 +71,6 @@ class RSpecTest < Minitest::Test
|
|
76
71
|
appmap = JSON.parse(File.read(appmap_file))
|
77
72
|
assert_includes appmap.keys, 'metadata'
|
78
73
|
metadata = appmap['metadata']
|
79
|
-
assert_equal %w[hello speak], metadata['labels'].sort
|
80
74
|
end
|
81
75
|
end
|
82
76
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.42.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -548,7 +548,6 @@ files:
|
|
548
548
|
- spec/railtie_spec.rb
|
549
549
|
- spec/record_sql_rails_pg_spec.rb
|
550
550
|
- spec/remote_recording_spec.rb
|
551
|
-
- spec/rspec_feature_metadata_spec.rb
|
552
551
|
- spec/spec_helper.rb
|
553
552
|
- spec/util_spec.rb
|
554
553
|
- test/cli_test.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_spec_helper'
|
4
|
-
|
5
|
-
describe 'RSpec feature and feature group metadata' do
|
6
|
-
include_examples 'Rails app pg database', 'spec/fixtures/rails5_users_app' do
|
7
|
-
around(:each) do |example|
|
8
|
-
FileUtils.rm_rf tmpdir
|
9
|
-
FileUtils.mkdir_p tmpdir
|
10
|
-
cmd = "docker-compose run --rm -e RAILS_ENV=test -e APPMAP=true -v #{File.absolute_path(tmpdir).shellescape}:/app/tmp app ./bin/rspec spec/models/user_spec.rb"
|
11
|
-
run_cmd cmd, chdir: fixture_dir
|
12
|
-
|
13
|
-
example.run
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:tmpdir) { 'tmp/spec/RSpec feature and feature group metadata' }
|
17
|
-
let(:appmap_json) { File.join(tmpdir, %(appmap/rspec/User_creation_creates_charles.appmap.json)) }
|
18
|
-
|
19
|
-
describe do
|
20
|
-
it 'are recorded in the appmap' do
|
21
|
-
expect(File).to exist(appmap_json)
|
22
|
-
appmap = JSON.parse(File.read(appmap_json)).to_yaml
|
23
|
-
|
24
|
-
expect(appmap).to include(<<-METADATA.strip)
|
25
|
-
feature: Create a user
|
26
|
-
feature_group: User
|
27
|
-
METADATA
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|