fixtury 2.0.2 → 2.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d721c0d209b0c6d3862fbbc522c7c658de4b65ec717dd06cd14c3fdc1813841
4
- data.tar.gz: 139981e92652bd20c0c272324e0c0e0c24ac06ad1d22f7bb46c2e01719d358ca
3
+ metadata.gz: eddc0719dafeefce9c31300b44475af08c14429c7b1de69328cef38fa1c6f6fb
4
+ data.tar.gz: b79ec0e74adf1bff8b1f0f03b875c5e83dde1c02856908122e03ae51c93eab9c
5
5
  SHA512:
6
- metadata.gz: 874a770245b43bec8d2de2d116acf0b7ea4e4b40565561784f25318c731afcca0c0e07078cec7ffef4988674a168f34891aeecdae1b55dfdd11309cfd08fb411
7
- data.tar.gz: 19539f08615abc69f2b4659107336478424c917e83f6200457be6d8cb25e3b6157b1e75cf235abcd8d11051bdbf8070e1a2aa881df7be4feb5da2ab5df436a0e
6
+ metadata.gz: 33daa75ff819a5a3d22cdb773fd08eb35e8859f401e83e0246c481ef2030a1438d9376eb66ab9e5db3c566da130fc46e0af56a5744b9e194ae2ce7801611fb21
7
+ data.tar.gz: 1ec5c972ed02e9760d0a064616c047d2d78d0ace61d1e9a43db0d36d54b911e2ea65ff83503e15dd1d47ec4992d55f4e8afecfdc09a0f0ba12cfaad0cf07cf0c
data/fixtury.gemspec CHANGED
@@ -12,18 +12,15 @@ Gem::Specification.new do |spec|
12
12
 
13
13
  spec.summary = "Treat fixtures like factories and factories like fixtures"
14
14
  spec.homepage = "https://github.com/guideline-tech/fixtury"
15
+ spec.license = "MIT"
15
16
 
16
17
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
- spec.metadata["homepage_uri"] = spec.homepage
18
- spec.metadata["source_code_uri"] = spec.homepage
19
- spec.metadata["changelog_uri"] = spec.homepage
18
+ spec.metadata["rubygems_mfa_required"] = "true"
20
19
 
21
20
  # Specify which files should be added to the gem when it is released.
22
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
- end
26
- spec.bindir = "exe"
21
+ spec.files = Dir["lib/**/*"] + Dir["*.gemspec"] + Dir["bin/**/*"]
22
+
23
+ spec.bindir = "bin"
27
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
25
  spec.require_paths = ["lib"]
29
26
 
@@ -36,4 +33,6 @@ Gem::Specification.new do |spec|
36
33
  spec.add_development_dependency "mocha"
37
34
  spec.add_development_dependency "rake"
38
35
  spec.add_development_dependency "sqlite3"
36
+
37
+ spec.required_ruby_version = ">= 3.3.0"
39
38
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "forwardable"
4
+
3
5
  module Fixtury
4
6
  # A class that contains the definition of a fixture. It also maintains a list of it's
5
7
  # dependencies to allow for analysis of the fixture graph.
data/lib/fixtury/store.rb CHANGED
@@ -12,7 +12,6 @@ module Fixtury
12
12
 
13
13
  attr_reader :locator
14
14
  attr_reader :schema
15
- attr_reader :ttl
16
15
 
17
16
  def initialize(schema: nil)
18
17
  @schema = schema || ::Fixtury.schema
@@ -3,8 +3,8 @@
3
3
  module Fixtury
4
4
 
5
5
  MAJOR = 2
6
- MINOR = 0
7
- PATCH = 2
6
+ MINOR = 3
7
+ PATCH = 0
8
8
  PRERELEASE = nil
9
9
 
10
10
  VERSION = [MAJOR, MINOR, PATCH, PRERELEASE].compact.join(".")
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixtury
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Nelson
8
- autorequire:
9
- bindir: exe
8
+ bindir: bin
10
9
  cert_chain: []
11
- date: 2025-02-05 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -136,21 +135,12 @@ dependencies:
136
135
  - - ">="
137
136
  - !ruby/object:Gem::Version
138
137
  version: '0'
139
- description:
140
138
  email:
141
139
  - mike@guideline.com
142
140
  executables: []
143
141
  extensions: []
144
142
  extra_rdoc_files: []
145
143
  files:
146
- - ".github/dependabot.yml"
147
- - ".github/workflows/build.yml"
148
- - ".gitignore"
149
- - ".ruby-version"
150
- - Gemfile
151
- - Gemfile.lock
152
- - README.md
153
- - Rakefile
154
144
  - bin/console
155
145
  - bin/setup
156
146
  - fixtury.gemspec
@@ -176,13 +166,11 @@ files:
176
166
  - lib/fixtury/store.rb
177
167
  - lib/fixtury/version.rb
178
168
  homepage: https://github.com/guideline-tech/fixtury
179
- licenses: []
169
+ licenses:
170
+ - MIT
180
171
  metadata:
181
172
  allowed_push_host: https://rubygems.org
182
- homepage_uri: https://github.com/guideline-tech/fixtury
183
- source_code_uri: https://github.com/guideline-tech/fixtury
184
- changelog_uri: https://github.com/guideline-tech/fixtury
185
- post_install_message:
173
+ rubygems_mfa_required: 'true'
186
174
  rdoc_options: []
187
175
  require_paths:
188
176
  - lib
@@ -190,15 +178,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
178
  requirements:
191
179
  - - ">="
192
180
  - !ruby/object:Gem::Version
193
- version: '0'
181
+ version: 3.3.0
194
182
  required_rubygems_version: !ruby/object:Gem::Requirement
195
183
  requirements:
196
184
  - - ">="
197
185
  - !ruby/object:Gem::Version
198
186
  version: '0'
199
187
  requirements: []
200
- rubygems_version: 3.5.23
201
- signing_key:
188
+ rubygems_version: 4.0.9
202
189
  specification_version: 4
203
190
  summary: Treat fixtures like factories and factories like fixtures
204
191
  test_files: []
@@ -1,35 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: "github-actions"
4
- directory: "/"
5
- open-pull-requests-limit: 20
6
- schedule:
7
- interval: "daily"
8
- time: "09:00"
9
- timezone: "America/New_York"
10
- commit-message:
11
- prefix: "[github-actions] "
12
- - package-ecosystem: "bundler"
13
- directory: "/"
14
- schedule:
15
- interval: "daily"
16
- time: "08:30"
17
- timezone: "America/New_York"
18
- allow:
19
- - dependency-type: "all"
20
- versioning-strategy: increase
21
- open-pull-requests-limit: 20
22
- insecure-external-code-execution: deny
23
- commit-message:
24
- prefix: "[bundler] "
25
- groups:
26
- monthly:
27
- patterns:
28
- - "*"
29
- ignore:
30
- - dependency-name: "activesupport"
31
- update-types: ["version-update:semver-major"]
32
- - dependency-name: "activemodel"
33
- update-types: ["version-update:semver-major"]
34
- - dependency-name: "activerecord"
35
- update-types: ["version-update:semver-major"]
@@ -1,23 +0,0 @@
1
- name: build
2
- on:
3
- pull_request:
4
- push:
5
- branches:
6
- - main
7
- jobs:
8
- build:
9
- runs-on: ubuntu-latest
10
- strategy:
11
- fail-fast: false
12
- matrix:
13
- ruby-version: [3.2.6]
14
- experimental: [false]
15
- steps:
16
- - uses: actions/checkout@v4
17
- with:
18
- show-progress: 'false'
19
- - uses: ruby/setup-ruby@v1
20
- with:
21
- ruby-version: ${{ matrix.ruby-version }}
22
- bundler-cache: true # runs `bundle install` and caches installed gems automatically
23
- - run: bundle exec rake
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- .byebug_history
10
- *.gem
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.2.6
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in fixtury.gemspec
4
- gemspec
data/Gemfile.lock DELETED
@@ -1,129 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- fixtury (2.0.2)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- activemodel (7.2.2.1)
10
- activesupport (= 7.2.2.1)
11
- activerecord (7.2.2.1)
12
- activemodel (= 7.2.2.1)
13
- activesupport (= 7.2.2.1)
14
- timeout (>= 0.4.0)
15
- activesupport (7.2.2.1)
16
- base64
17
- benchmark (>= 0.3)
18
- bigdecimal
19
- concurrent-ruby (~> 1.0, >= 1.3.1)
20
- connection_pool (>= 2.2.5)
21
- drb
22
- i18n (>= 1.6, < 2)
23
- logger (>= 1.4.2)
24
- minitest (>= 5.1)
25
- securerandom (>= 0.3)
26
- tzinfo (~> 2.0, >= 2.0.5)
27
- base64 (0.2.0)
28
- benchmark (0.4.0)
29
- bigdecimal (3.1.9)
30
- byebug (11.1.3)
31
- concurrent-ruby (1.3.5)
32
- connection_pool (2.5.0)
33
- drb (2.2.1)
34
- globalid (1.2.1)
35
- activesupport (>= 6.1)
36
- i18n (1.14.7)
37
- concurrent-ruby (~> 1.0)
38
- logger (1.6.5)
39
- m (1.6.2)
40
- method_source (>= 0.6.7)
41
- rake (>= 0.9.2.2)
42
- method_source (1.1.0)
43
- mini_portile2 (2.8.8)
44
- minitest (5.25.4)
45
- mocha (2.7.1)
46
- ruby2_keywords (>= 0.0.5)
47
- rake (13.2.1)
48
- ruby2_keywords (0.0.5)
49
- securerandom (0.4.1)
50
- sqlite3 (2.5.0)
51
- mini_portile2 (~> 2.8.0)
52
- sqlite3 (2.5.0-aarch64-linux-gnu)
53
- sqlite3 (2.5.0-aarch64-linux-musl)
54
- sqlite3 (2.5.0-arm-linux-gnu)
55
- sqlite3 (2.5.0-arm-linux-musl)
56
- sqlite3 (2.5.0-arm64-darwin)
57
- sqlite3 (2.5.0-x86-linux-gnu)
58
- sqlite3 (2.5.0-x86-linux-musl)
59
- sqlite3 (2.5.0-x86_64-darwin)
60
- sqlite3 (2.5.0-x86_64-linux-gnu)
61
- sqlite3 (2.5.0-x86_64-linux-musl)
62
- timeout (0.4.3)
63
- tzinfo (2.0.6)
64
- concurrent-ruby (~> 1.0)
65
-
66
- PLATFORMS
67
- aarch64-linux-gnu
68
- aarch64-linux-musl
69
- arm-linux-gnu
70
- arm-linux-musl
71
- arm64-darwin
72
- ruby
73
- x86-linux-gnu
74
- x86-linux-musl
75
- x86_64-darwin
76
- x86_64-linux-gnu
77
- x86_64-linux-musl
78
-
79
- DEPENDENCIES
80
- activerecord
81
- bundler
82
- byebug
83
- fixtury!
84
- globalid
85
- m
86
- minitest
87
- mocha
88
- rake
89
- sqlite3
90
-
91
- CHECKSUMS
92
- activemodel (7.2.2.1) sha256=8398861f9ee2c4671a8357ab39e9b38a045fd656f6685a3dd5890c2419dbfdaf
93
- activerecord (7.2.2.1) sha256=79a31f71c32d5138717c2104e0ff105f5d82922247c85bdca144f2720e67fab9
94
- activesupport (7.2.2.1) sha256=842bcbf8a92977f80fb4750661a237cf5dd4fdd442066b3c35e88afb488647f5
95
- base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507
96
- benchmark (0.4.0) sha256=0f12f8c495545e3710c3e4f0480f63f06b4c842cc94cec7f33a956f5180e874a
97
- bigdecimal (3.1.9) sha256=2ffc742031521ad69c2dfc815a98e426a230a3d22aeac1995826a75dabfad8cc
98
- byebug (11.1.3) sha256=2485944d2bb21283c593d562f9ae1019bf80002143cc3a255aaffd4e9cf4a35b
99
- concurrent-ruby (1.3.5) sha256=813b3e37aca6df2a21a3b9f1d497f8cbab24a2b94cab325bffe65ee0f6cbebc6
100
- connection_pool (2.5.0) sha256=233b92f8d38e038c1349ccea65dd3772727d669d6d2e71f9897c8bf5cd53ebfc
101
- drb (2.2.1) sha256=e9d472bf785f558b96b25358bae115646da0dbfd45107ad858b0bc0d935cb340
102
- fixtury (2.0.2)
103
- globalid (1.2.1) sha256=70bf76711871f843dbba72beb8613229a49429d1866828476f9c9d6ccc327ce9
104
- i18n (1.14.7) sha256=ceba573f8138ff2c0915427f1fc5bdf4aa3ab8ae88c8ce255eb3ecf0a11a5d0f
105
- logger (1.6.5) sha256=c3cfe56d01656490ddd103d38b8993d73d86296adebc5f58cefc9ec03741e56b
106
- m (1.6.2) sha256=2fb85aff050b6b699e6dbca47b45d426e2136ccdfabb64437e9630230d29108e
107
- method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
108
- mini_portile2 (2.8.8) sha256=8e47136cdac04ce81750bb6c09733b37895bf06962554e4b4056d78168d70a75
109
- minitest (5.25.4) sha256=9cf2cae25ac4dfc90c988ebc3b917f53c054978b673273da1bd20bcb0778f947
110
- mocha (2.7.1) sha256=8f7d538d5d3ebc75fc788b3d92fbab913a93a78462d2a3ce99d1bdde7af7f851
111
- rake (13.2.1) sha256=46cb38dae65d7d74b6020a4ac9d48afed8eb8149c040eccf0523bec91907059d
112
- ruby2_keywords (0.0.5) sha256=ffd13740c573b7301cf7a2e61fc857b2a8e3d3aff32545d6f8300d8bae10e3ef
113
- securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
114
- sqlite3 (2.5.0) sha256=87fa0036e6369c3f3cfeca749865c2b2b63649d3b17b223d1939a8eed4841a6b
115
- sqlite3 (2.5.0-aarch64-linux-gnu) sha256=302085c3b932c027bc8de9f45fb5d0a3dc502357908dcc8f9bc8a92e4e9c7ab1
116
- sqlite3 (2.5.0-aarch64-linux-musl) sha256=f6c8d25a6c7175bed154da82bc4c1ea3ef48580aeca17400b2e730c026821857
117
- sqlite3 (2.5.0-arm-linux-gnu) sha256=5f22b4c72c38570593f9fe351751cb269568594525e0e3e0776187a3f1a55f32
118
- sqlite3 (2.5.0-arm-linux-musl) sha256=b8e672106f341e9e4c85cdbc218710521c92082eec0ba61c180fb27a9c7780c6
119
- sqlite3 (2.5.0-arm64-darwin) sha256=65370ddbc7bd7e65a03c18f8bf0e9be0f4f3cf50f758f8c1d3181aece5515ecf
120
- sqlite3 (2.5.0-x86-linux-gnu) sha256=90488e9278ff23b9b22387a01354d5350b94d346fa9ab09256f154d0ca90dec6
121
- sqlite3 (2.5.0-x86-linux-musl) sha256=09dd65d3752fb9d5cd93df841cbc357d2d117118f96f8b4122cd9cb38e020295
122
- sqlite3 (2.5.0-x86_64-darwin) sha256=e3c6d2fa04db9d0773455cb6c79835f230c363424b69c34dd718e1aff8609d35
123
- sqlite3 (2.5.0-x86_64-linux-gnu) sha256=c62c8d625da7e2ce93d694f02cd9c9d537638f56b09f2e8f28bea2d030b3923b
124
- sqlite3 (2.5.0-x86_64-linux-musl) sha256=09fd262943eeb89465f6633e748b702b046de24cdab14b197302d0f4a0e250cb
125
- timeout (0.4.3) sha256=9509f079b2b55fe4236d79633bd75e34c1c1e7e3fb4b56cb5fda61f80a0fe30e
126
- tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
127
-
128
- BUNDLED WITH
129
- 2.6.3
data/README.md DELETED
@@ -1,113 +0,0 @@
1
- # Fixtury
2
-
3
- Fixtury aims to provide an interface for creating, managing, and accessing test data in a simple and on-demand way. It has no opinion on how you generate the data, it simply provides efficient ways to access it.
4
-
5
- Often, fixture frameworks require you to either heavily maintain static fixtures or generate all your fixtures at runtime. Fixtury attempts to find a middle ground that enables a faster and more effecient development process while allowing you to generate realistic test data.
6
-
7
- For example, if a developer is running a test locally in their development environment there's no reason to build all fixtures for your suite of 30k tests. Instead, if we're able to track the fixture dependencies of the tests that are running we can build (and cache) the data relevant for the specific tests that are run.
8
-
9
- ```ruby
10
- require "fixtury/minitest_hooks"
11
-
12
- class MyTest < ::Minitest::Test
13
- prepend ::Fixtury::MintestHooks
14
-
15
- fixtury "users/fresh", as: :user
16
-
17
- def test_whatever
18
- assert_eq "Doug", user.first_name
19
- end
20
-
21
- end
22
- ```
23
-
24
- Loading this file would ensure `users/fresh` is loaded into the fixture set before the suite is run. In the context of Minitest::Test, the Fixtury::MinitestHooks file will ensure the fixtures are present prior to your suite running.
25
-
26
- ## Configuration
27
-
28
- If you're using Rails, you can `require "fixtury/railtie"` to accomplish a standard installation which will observe common rails files for changes and expects fixture definitions to defined in `test/fixtures`. See the railtie class for details.
29
-
30
- For non-rails environments or additional configuration, you can open up the Fixtury configuration like so:
31
- ```ruby
32
- ::Fixtury.configure do |config|
33
- config.locator_backend = :global_id # the locator behavior to use for finding fixtures
34
- config.filepath = File.join(root, "tmp/fixtury.yml") # the location to dump the fixtury references
35
- config.add_fixture_path = File.join(root, "fixtures/**/*.rb")
36
- config.add_dependency_path = File.join(root, "db/schema.rb")
37
- end
38
- ```
39
- See Fixtury::Configuration for all options.
40
-
41
- When your Fixtury is configured, you should call `Fixtury.start`.
42
-
43
- For minitest integration, you should dump the configuration file after the suite runs or after your fixture dependencies are built:
44
-
45
- ```ruby
46
- ::Minitest.after_run do
47
- ::Fixtury.configuration.dump_file
48
- end
49
- ```
50
-
51
- In a CI environment, we'd likely want to preload all fixtures to produce a database snapshot to be shared. This can be done by configuring Fixtury, calling `Fixtury.start`, then calling `Fixtury.load_all_fixtures`. All fixtures declared in the configuration's fixture_paths will be loaded.
52
-
53
- ## Defining Fixtures
54
-
55
- There are two primary principals in Fixtury: namespaces and fixture definitions. See below for an example of how they're used.
56
-
57
- ```ruby
58
- Fixtury.define do
59
-
60
- fixture "user" do
61
- User.create(...)
62
- end
63
-
64
- namespace "addresses" do
65
- fixture "sample" do
66
- Address.create(...)
67
- end
68
- end
69
-
70
- namespace "user_with_address" do
71
- fixture "user", deps: "address" do |deps|
72
- User.create(address_id: deps.address.id, ...)
73
- end
74
-
75
- fixture "address" do
76
- Address.create(...)
77
- end
78
- end
79
- end
80
- ```
81
-
82
- As you can see fixtures are named in a nested structure and can refer to each other via dependencies. See Fixtury::Dependency for more specifics.
83
-
84
- ## Isolation Levels
85
-
86
- Isolation keys enable groups of fixtures to use and modify the same resources. When one fixture from an isolation level is built, all fixtures in that isolation level are built. This allows multiple fixtures to potentially mutate a resource while keeping the definition consistent.
87
-
88
- ```ruby
89
- Fixtury.define do
90
- namespace "use_cases" do
91
- namespace "onboarded", isolate: true do
92
-
93
- fixture "user" do
94
- User.create(...)
95
- end
96
-
97
- fixture "profile", deps: "user" do |deps|
98
- profile = Profile.create(user: deps.user, ...)
99
- user.update(profiles_count: 1, onboarded_at: Time.current)
100
- profile
101
- end
102
-
103
- end
104
- end
105
- end
106
- ```
107
-
108
- ### ActiveRecord Integration
109
-
110
- When installed with the railtie, a MutationObserver module is prepended into ActiveRecord::Base. It observes record mutations and ensures a record is not mutated outside of the declared isolation level. If you're not using ActiveRecord check out Fixtury::MutationObserver to see how you could hook into other frameworks.
111
-
112
- In your test suite when utilizing the Fixtury::MinitestHooks records will be loaded before ActiveRecord's transactional fixtures transaction is opened. This means the you can define all your fixtures in your tests, they will be prebuilt and, as long as the fixtury references are preserved, all your fixtures are cached across runs. The fixtures in each file are loaded on demand which means only the fixtures necessary for the test to run are prebuilt (and cached for reuse). Standard transactional fixture rollback occurs after each test run so any mutation to fixtures will not be persisted.
113
-
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- end
9
-
10
- task :default => :test