factory_bot_instrumentation 2.8.0 → 3.0.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/.github/workflows/release.yml +3 -3
- data/.github/workflows/test.yml +3 -3
- data/.gitignore +1 -0
- data/.rubocop.yml +6 -2
- data/Appraisals +0 -4
- data/CHANGELOG.md +17 -0
- data/Dockerfile +3 -3
- data/Gemfile +1 -1
- data/Makefile +8 -2
- data/Rakefile +19 -0
- data/app/assets/javascripts/factory_bot_instrumentation/application.js +454 -12
- data/app/assets/stylesheets/factory_bot_instrumentation/application.css +31 -33
- data/factory_bot_instrumentation.gemspec +9 -2
- data/gemfiles/rails_8.1.gemfile +1 -1
- data/lib/factory_bot/instrumentation/asset_bundler.rb +194 -0
- data/lib/factory_bot/instrumentation/engine.rb +24 -0
- data/lib/factory_bot/instrumentation/version.rb +1 -1
- data/lib/factory_bot/instrumentation.rb +3 -0
- metadata +4 -9
- data/app/assets/config/factory_bot_instrumentation_manifest.js +0 -2
- data/app/assets/javascripts/factory_bot_instrumentation/create.js +0 -134
- data/app/assets/javascripts/factory_bot_instrumentation/hooks.js +0 -123
- data/app/assets/javascripts/factory_bot_instrumentation/lib/form.js +0 -66
- data/app/assets/javascripts/factory_bot_instrumentation/lib/utils.js +0 -116
- data/gemfiles/rails_8.0.gemfile +0 -22
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
window.Form = Form = function(scope)
|
|
2
|
-
{
|
|
3
|
-
this.button = $(scope).find('button');
|
|
4
|
-
this.result = $('#result');
|
|
5
|
-
this.spinner = $('#spinner');
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
Form.prototype.bind = function(action)
|
|
9
|
-
{
|
|
10
|
-
this.button.on('click', (event) => {
|
|
11
|
-
event.preventDefault();
|
|
12
|
-
this.hideResult();
|
|
13
|
-
action(event);
|
|
14
|
-
return false;
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
Form.prototype.hideResult = function()
|
|
19
|
-
{
|
|
20
|
-
this.result.hide();
|
|
21
|
-
this.button.prop('disabled', true);
|
|
22
|
-
this.spinner.show();
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
Form.prototype.showResultContainer = function(html)
|
|
26
|
-
{
|
|
27
|
-
this.result.html(html);
|
|
28
|
-
$('pre').each((i, block) => hljs.highlightBlock(block));
|
|
29
|
-
new ClipboardJS('.cb-copy');
|
|
30
|
-
this.result.show();
|
|
31
|
-
this.button.prop('disabled', false);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
Form.prototype.showError = function(payload, output)
|
|
35
|
-
{
|
|
36
|
-
this.spinner.hide();
|
|
37
|
-
output = window.utils.prepareOutput(output);
|
|
38
|
-
this.errorContent(payload, output, (err, html) => {
|
|
39
|
-
this.showResultContainer(html);
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
Form.prototype.errorContent = function(payload, output, cb)
|
|
44
|
-
{
|
|
45
|
-
cb(null, `
|
|
46
|
-
<pre id="data">${output}</pre>
|
|
47
|
-
${window.utils.clipboardButton()}
|
|
48
|
-
`);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
Form.prototype.showResult = function(payload, output)
|
|
52
|
-
{
|
|
53
|
-
this.spinner.hide();
|
|
54
|
-
output = window.utils.prepareOutput(output);
|
|
55
|
-
this.resultContent(payload, output, (err, html) => {
|
|
56
|
-
this.showResultContainer(html);
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
Form.prototype.resultContent = function(payload, output, cb)
|
|
61
|
-
{
|
|
62
|
-
cb(null, `
|
|
63
|
-
<pre id="data">${output}</pre>
|
|
64
|
-
${window.utils.clipboardButton()}
|
|
65
|
-
`);
|
|
66
|
-
};
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
window.utils = Utils = {};
|
|
2
|
-
|
|
3
|
-
Utils.pushWaterfallPayload = function(data)
|
|
4
|
-
{
|
|
5
|
-
return (cb) => cb(null, data);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
Utils.waterfallWithHooks = function(opts, cb)
|
|
9
|
-
{
|
|
10
|
-
cb = cb || function(){};
|
|
11
|
-
opts = Object.assign({
|
|
12
|
-
pre: [],
|
|
13
|
-
post: [],
|
|
14
|
-
data: {},
|
|
15
|
-
action: (payload, cb) => cb(null, payload)
|
|
16
|
-
}, opts);
|
|
17
|
-
|
|
18
|
-
async.waterfall([
|
|
19
|
-
// Yield the data to pre hooks
|
|
20
|
-
Utils.pushWaterfallPayload(opts.data),
|
|
21
|
-
// Perform pre hooks
|
|
22
|
-
...opts.pre,
|
|
23
|
-
// Perform the create request
|
|
24
|
-
opts.action,
|
|
25
|
-
// Perform post hooks
|
|
26
|
-
...opts.post
|
|
27
|
-
], cb);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
Utils.request = function(opts, cb)
|
|
31
|
-
{
|
|
32
|
-
opts = Object.assign({
|
|
33
|
-
url: '/',
|
|
34
|
-
type: 'POST',
|
|
35
|
-
data: '{}',
|
|
36
|
-
dataType: 'json',
|
|
37
|
-
contentType: 'application/json; charset=utf-8',
|
|
38
|
-
ignoreErrors: false
|
|
39
|
-
}, opts || {}, {
|
|
40
|
-
success: (result) => cb(null, result)
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
errCb = (err) => cb(err);
|
|
44
|
-
if (opts.ignoreErrors) {
|
|
45
|
-
errCb = (err) => cb(null, err);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
$.ajax(opts).fail(errCb);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
Utils.escape = function(str)
|
|
52
|
-
{
|
|
53
|
-
return str.replace(/&/g, "&")
|
|
54
|
-
.replace(/</g, "<")
|
|
55
|
-
.replace(/>/g, ">");
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
Utils.prepareOutput = function(output)
|
|
59
|
-
{
|
|
60
|
-
try {
|
|
61
|
-
if (typeof output !== 'object') { output = JSON.parse(output); }
|
|
62
|
-
output = JSON.stringify(output, null, 2);
|
|
63
|
-
} catch { }
|
|
64
|
-
|
|
65
|
-
return window.utils.escape(output);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
Utils.clipboardButton = function(id)
|
|
69
|
-
{
|
|
70
|
-
id = id || 'data';
|
|
71
|
-
return `
|
|
72
|
-
<span class="btn btn-primary cb-copy"
|
|
73
|
-
data-clipboard-target="#${id}">
|
|
74
|
-
<i class="fas fa-paste"></i> Copy result to clipboard
|
|
75
|
-
</span>
|
|
76
|
-
`;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
Utils.clipboardBadge = function(id)
|
|
80
|
-
{
|
|
81
|
-
id = id || 'data';
|
|
82
|
-
return `
|
|
83
|
-
<span class="badge badge-dark cb-copy" title="Copy result to clipboard"
|
|
84
|
-
data-clipboard-target="#${id}"><i class="fas fa-paste"></i>
|
|
85
|
-
</span>
|
|
86
|
-
`;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
Utils.card = function(opts)
|
|
90
|
-
{
|
|
91
|
-
opts = Object.assign({
|
|
92
|
-
id: 'details',
|
|
93
|
-
icon: 'fa-asterisk',
|
|
94
|
-
title: 'Details',
|
|
95
|
-
body: ''
|
|
96
|
-
}, opts || {});
|
|
97
|
-
|
|
98
|
-
return `
|
|
99
|
-
<div class="card">
|
|
100
|
-
<div class="card-header">
|
|
101
|
-
<h5 class="mb-0">
|
|
102
|
-
<button class="btn btn-link collapsed" type="button"
|
|
103
|
-
data-toggle="collapse" data-target="#${opts.id}"
|
|
104
|
-
aria-expanded="false">
|
|
105
|
-
<i class="fas ${opts.icon}"></i> ${opts.title}</h5>
|
|
106
|
-
</button>
|
|
107
|
-
</h5>
|
|
108
|
-
</div>
|
|
109
|
-
<div id="${opts.id}" class="collapse" data-parent="#response">
|
|
110
|
-
<div class="card-body">
|
|
111
|
-
${opts.body}
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
`;
|
|
116
|
-
};
|
data/gemfiles/rails_8.0.gemfile
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# This file was generated by Appraisal
|
|
2
|
-
|
|
3
|
-
source "https://rubygems.org"
|
|
4
|
-
|
|
5
|
-
gem "appraisal", "~> 2.4"
|
|
6
|
-
gem "bundler", ">= 2.6", "< 5"
|
|
7
|
-
gem "countless", "~> 2.2"
|
|
8
|
-
gem "factory_bot_rails", "~> 6.2"
|
|
9
|
-
gem "guard-rspec", "~> 4.7"
|
|
10
|
-
gem "railties", ">= 8.0"
|
|
11
|
-
gem "rspec-rails", "~> 7.1"
|
|
12
|
-
gem "rubocop"
|
|
13
|
-
gem "rubocop-rails"
|
|
14
|
-
gem "rubocop-rspec"
|
|
15
|
-
gem "simplecov", ">= 0.22"
|
|
16
|
-
gem "sqlite3", "~> 2.7"
|
|
17
|
-
gem "timecop", ">= 0.9.6"
|
|
18
|
-
gem "yard", ">= 0.9.28"
|
|
19
|
-
gem "yard-activesupport-concern", ">= 0.0.1"
|
|
20
|
-
gem "rails", "~> 8.0.0"
|
|
21
|
-
|
|
22
|
-
gemspec path: "../"
|