fixtury 0.1.0 → 0.2.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/Gemfile.lock +8 -8
- data/fixtury.gemspec +1 -1
- data/lib/fixtury.rb +0 -1
- data/lib/fixtury/definition.rb +9 -9
- data/lib/fixtury/store.rb +1 -2
- data/lib/fixtury/version.rb +1 -1
- metadata +4 -5
- data/lib/fixtury/execution_context.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43cad01d0dda49953fb41782235cb0786d60a0b84eb3d8e9f4145d6fa4268f04
|
4
|
+
data.tar.gz: 5f4347bcf7a8ef5b7c72d42802e260f7ecc1b0e8d3772f4681bbef2aa7e9a963
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adc92b02ad90ae0afd4f4b10d146e26663d3dfd0d428f9739d9cfcf147dde7d2e09b05f84e956f116af62123477bc453f343ca3bda0a3bf17ae6d7edf61d7f35
|
7
|
+
data.tar.gz: 4a5720793e764bc4f366512b8d172b31d64b68c89abd86862d2d199f68bd36b590e706bba56c8fa5471d071c5d84e370c30de0b7bf93109df3476d75caf22dca
|
data/Gemfile.lock
CHANGED
@@ -6,21 +6,21 @@ PATH
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activesupport (6.0.1)
|
9
|
+
activesupport (6.0.3.1)
|
10
10
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
11
11
|
i18n (>= 0.7, < 2)
|
12
12
|
minitest (~> 5.1)
|
13
13
|
tzinfo (~> 1.1)
|
14
|
-
zeitwerk (~> 2.2)
|
14
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
15
15
|
ansi (1.5.0)
|
16
16
|
autotest (5.0.0)
|
17
17
|
minitest-autotest (~> 1.0)
|
18
18
|
builder (3.2.3)
|
19
19
|
byebug (11.0.1)
|
20
|
-
concurrent-ruby (1.1.
|
20
|
+
concurrent-ruby (1.1.6)
|
21
21
|
globalid (0.4.2)
|
22
22
|
activesupport (>= 4.2.0)
|
23
|
-
i18n (1.
|
23
|
+
i18n (1.8.2)
|
24
24
|
concurrent-ruby (~> 1.0)
|
25
25
|
metaclass (0.0.4)
|
26
26
|
minitest (5.13.0)
|
@@ -37,13 +37,13 @@ GEM
|
|
37
37
|
mocha (1.8.0)
|
38
38
|
metaclass (~> 0.0.1)
|
39
39
|
path_expander (1.1.0)
|
40
|
-
rake (
|
40
|
+
rake (13.0.1)
|
41
41
|
ruby-progressbar (1.10.1)
|
42
42
|
sqlite (1.0.2)
|
43
43
|
thread_safe (0.3.6)
|
44
|
-
tzinfo (1.2.
|
44
|
+
tzinfo (1.2.7)
|
45
45
|
thread_safe (~> 0.1)
|
46
|
-
zeitwerk (2.
|
46
|
+
zeitwerk (2.3.0)
|
47
47
|
|
48
48
|
PLATFORMS
|
49
49
|
ruby
|
@@ -57,7 +57,7 @@ DEPENDENCIES
|
|
57
57
|
minitest (~> 5.0)
|
58
58
|
minitest-reporters
|
59
59
|
mocha
|
60
|
-
rake (~>
|
60
|
+
rake (~> 13.0)
|
61
61
|
sqlite
|
62
62
|
|
63
63
|
BUNDLED WITH
|
data/fixtury.gemspec
CHANGED
@@ -34,6 +34,6 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency "minitest", "~> 5.0"
|
35
35
|
spec.add_development_dependency "minitest-reporters"
|
36
36
|
spec.add_development_dependency "mocha"
|
37
|
-
spec.add_development_dependency "rake", "~>
|
37
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
38
38
|
spec.add_development_dependency "sqlite"
|
39
39
|
end
|
data/lib/fixtury.rb
CHANGED
data/lib/fixtury/definition.rb
CHANGED
@@ -25,8 +25,6 @@ module Fixtury
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def call(store: nil, execution_context: nil)
|
28
|
-
execution_context ||= ::Fixtury::ExecutionContext.new
|
29
|
-
|
30
28
|
maybe_set_store_context(store: store) do
|
31
29
|
value = run_callable(store: store, callable: callable, execution_context: execution_context, value: nil)
|
32
30
|
enhancements.each do |e|
|
@@ -46,7 +44,7 @@ module Fixtury
|
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
49
|
-
def run_callable(store:, callable:, execution_context
|
47
|
+
def run_callable(store:, callable:, execution_context: nil, value:)
|
50
48
|
args = []
|
51
49
|
args << value unless value.nil?
|
52
50
|
if callable.arity > args.length
|
@@ -55,21 +53,23 @@ module Fixtury
|
|
55
53
|
args << store
|
56
54
|
end
|
57
55
|
|
58
|
-
|
56
|
+
provide_execution_context_hooks(execution_context) do |ctxt|
|
59
57
|
if args.length.positive?
|
60
|
-
|
58
|
+
ctxt.instance_exec(*args, &callable)
|
61
59
|
else
|
62
|
-
|
60
|
+
ctxt.instance_eval(&callable)
|
63
61
|
end
|
64
62
|
end
|
65
63
|
end
|
66
64
|
|
67
|
-
def
|
65
|
+
def provide_execution_context_hooks(execution_context)
|
66
|
+
return yield self unless execution_context
|
67
|
+
|
68
68
|
execution_context.before_fixture(self) if execution_context.respond_to?(:before_fixture)
|
69
69
|
value = if execution_context.respond_to?(:around_fixture)
|
70
|
-
execution_context.around_fixture(self) { yield }
|
70
|
+
execution_context.around_fixture(self) { yield execution_context }
|
71
71
|
else
|
72
|
-
yield
|
72
|
+
yield execution_context
|
73
73
|
end
|
74
74
|
execution_context.after_fixture(self, value) if execution_context.respond_to?(:after_fixture)
|
75
75
|
value
|
data/lib/fixtury/store.rb
CHANGED
@@ -5,7 +5,6 @@ require "singleton"
|
|
5
5
|
require "yaml"
|
6
6
|
require "fixtury/locator"
|
7
7
|
require "fixtury/errors/circular_dependency_error"
|
8
|
-
require "fixtury/execution_context"
|
9
8
|
require "fixtury/reference"
|
10
9
|
|
11
10
|
module Fixtury
|
@@ -40,7 +39,7 @@ module Fixtury
|
|
40
39
|
@locator = locator
|
41
40
|
@filepath = filepath
|
42
41
|
@references = @filepath && ::File.file?(@filepath) ? ::YAML.load_file(@filepath) : {}
|
43
|
-
@execution_context = execution_context
|
42
|
+
@execution_context = execution_context
|
44
43
|
@ttl = ttl ? ttl.to_i : ttl
|
45
44
|
@auto_refresh_expired = !!auto_refresh_expired
|
46
45
|
self.class.instance ||= self
|
data/lib/fixtury/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fixtury
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Nelson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: autotest
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '13.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '13.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: sqlite
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,7 +160,6 @@ files:
|
|
160
160
|
- lib/fixtury/errors/fixture_not_defined_error.rb
|
161
161
|
- lib/fixtury/errors/schema_frozen_error.rb
|
162
162
|
- lib/fixtury/errors/unrecognizable_locator_error.rb
|
163
|
-
- lib/fixtury/execution_context.rb
|
164
163
|
- lib/fixtury/locator.rb
|
165
164
|
- lib/fixtury/locator_backend/common.rb
|
166
165
|
- lib/fixtury/locator_backend/globalid.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# a class made available so helper methods can be provided within the fixture dsl
|
4
|
-
module Fixtury
|
5
|
-
class ExecutionContext
|
6
|
-
|
7
|
-
def before_fixture(_dfn); end
|
8
|
-
|
9
|
-
def around_fixture(_dfn)
|
10
|
-
yield
|
11
|
-
end
|
12
|
-
|
13
|
-
def after_fixture(_dfn, _value); end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|