factory_bot_instrumentation 1.4.0 → 1.5.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 +9 -0
- data/README.md +14 -2
- data/app/controllers/factory_bot/instrumentation/application_controller.rb +7 -3
- data/app/controllers/factory_bot/instrumentation/root_controller.rb +0 -8
- data/lib/factory_bot/instrumentation/engine.rb +1 -0
- data/lib/factory_bot/instrumentation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83e360c563829d80a36e5bc4210a6a3da30233958a03d6c121a0158b445cb502
|
4
|
+
data.tar.gz: ee121882322897358b90092c0c88e8d0d70e416bc5a44188c78e34386aaa07ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a6f7e41ffe69853ef92f6708f8540b571917b78086084f52d0c8790e3aa1222661c3bbd0dc8b70867a506a8e3d412610ebb8b364130bcfc82022052b8304cc7
|
7
|
+
data.tar.gz: 01d84146f7db621d49a04ea6542e4a6bf570676a4c5405560a4aeb56b0b92f457d72163a480b0b2c583f756adfe36ce739bb3de35875b6ed9de7229693411a5e
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
* TODO: Replace this bullet point with an actual description of a change.
|
4
4
|
|
5
|
+
### 1.5.0 (7 January 2025)
|
6
|
+
|
7
|
+
* Switched from `ActionController::API` to `ActionController::Base` for the
|
8
|
+
engine's `ApplicationController` (#25)
|
9
|
+
|
10
|
+
### 1.4.1 (6 January 2025)
|
11
|
+
|
12
|
+
* Reverted (#23) as it causes errors for unknown reasons (#24)
|
13
|
+
|
5
14
|
### 1.4.0 (6 January 2025)
|
6
15
|
|
7
16
|
* Moved the instrumentation methods (`#instrumentation`, `#scenarios`,
|
data/README.md
CHANGED
@@ -243,7 +243,8 @@ application. The file
|
|
243
243
|
this:
|
244
244
|
|
245
245
|
```ruby
|
246
|
-
class Instrumentation::AuthenticationsController
|
246
|
+
class Instrumentation::AuthenticationsController \
|
247
|
+
< FactoryBot::Instrumentation::ApplicationController
|
247
248
|
# Generate a new web app authentication URL for the given email address.
|
248
249
|
# This endpoint creates new login URLs which are valid for 30 minutes.
|
249
250
|
def create
|
@@ -271,9 +272,20 @@ routes like this:
|
|
271
272
|
|
272
273
|
```ruby
|
273
274
|
Rails.application.routes.draw do
|
274
|
-
|
275
|
+
if ActiveModel::Type::Boolean.new.cast(ENV.fetch('INSTRUMENTATION_API',
|
276
|
+
false))
|
275
277
|
mount FactoryBot::Instrumentation::Engine => '/instrumentation'
|
276
278
|
end
|
279
|
+
|
280
|
+
# or with custom controllers in an namespace
|
281
|
+
|
282
|
+
if ActiveModel::Type::Boolean.new.cast(ENV.fetch('INSTRUMENTATION_API',
|
283
|
+
false))
|
284
|
+
namespace :instrumentation do
|
285
|
+
mount FactoryBot::Instrumentation::Engine => '/'
|
286
|
+
resource :authentication, only: :create
|
287
|
+
end
|
288
|
+
end
|
277
289
|
end
|
278
290
|
```
|
279
291
|
|
@@ -3,12 +3,18 @@
|
|
3
3
|
module FactoryBot
|
4
4
|
module Instrumentation
|
5
5
|
# A base engine application controller.
|
6
|
-
class ApplicationController < ActionController::
|
6
|
+
class ApplicationController < ActionController::Base
|
7
7
|
# Extend our core functionality to support easy authentication logics
|
8
8
|
include ActionController::HttpAuthentication::Basic::ControllerMethods
|
9
9
|
include ActionController::HttpAuthentication::Digest::ControllerMethods
|
10
10
|
include ActionController::HttpAuthentication::Token::ControllerMethods
|
11
11
|
|
12
|
+
# Rails 5.2 enabled CSRF protection by default, but this may be different
|
13
|
+
# on the host application. Therefore we cannot blindly disable it via
|
14
|
+
# +skip_forgery_protection+. We have to "enable" it for no routes, which
|
15
|
+
# eventually disables it entirely for this engine.
|
16
|
+
protect_from_forgery only: []
|
17
|
+
|
12
18
|
# Allow the users to implement additional instrumentation-wide before
|
13
19
|
# action logic, like authentication
|
14
20
|
before_action do |_controller|
|
@@ -19,8 +25,6 @@ module FactoryBot
|
|
19
25
|
end
|
20
26
|
end
|
21
27
|
|
22
|
-
protected
|
23
|
-
|
24
28
|
# A simple shortcut for Basic Auth on Rails 4.2+. Just configure the
|
25
29
|
# username and password and you're ready to check the current request.
|
26
30
|
#
|
@@ -4,12 +4,6 @@ module FactoryBot
|
|
4
4
|
module Instrumentation
|
5
5
|
# The Instrumentation engine controller with frontend and API actions.
|
6
6
|
class RootController < ApplicationController
|
7
|
-
# This is required to make API controllers template renderable
|
8
|
-
include ActionView::Layouts
|
9
|
-
|
10
|
-
# Configure the default application layout
|
11
|
-
layout 'factory_bot/instrumentation/application'
|
12
|
-
|
13
7
|
# Show the instrumentation frontend which features the output of
|
14
8
|
# configured dynamic seeds scenarios. The frontend allows humans to
|
15
9
|
# generate new seed data on the fly.
|
@@ -53,8 +47,6 @@ module FactoryBot
|
|
53
47
|
FactoryBot::Instrumentation.configuration.render_error.call(self, e)
|
54
48
|
end
|
55
49
|
|
56
|
-
protected
|
57
|
-
|
58
50
|
# Parse the given parameters from the request and build
|
59
51
|
# a valid FactoryBot options set.
|
60
52
|
#
|
@@ -5,6 +5,7 @@ module FactoryBot
|
|
5
5
|
# The Instrumentation engine which can be mounted.
|
6
6
|
class Engine < ::Rails::Engine
|
7
7
|
isolate_namespace FactoryBot::Instrumentation
|
8
|
+
engine_name 'factory_bot_instrumentation'
|
8
9
|
|
9
10
|
# Fill in some dynamic settings (application related)
|
10
11
|
initializer 'factory_bot_instrumentation.config' do |app|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_bot_instrumentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hermann Mayer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: factory_bot
|