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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a4447982d6e785c9158850f3d158b07e1226f6a05d85917d41307c5455d41d9
4
- data.tar.gz: c7fac4726892a1851ca7b7f0d3ff8abfe2bbedf4d2706b2c3ae6443d6be863f1
3
+ metadata.gz: 43cad01d0dda49953fb41782235cb0786d60a0b84eb3d8e9f4145d6fa4268f04
4
+ data.tar.gz: 5f4347bcf7a8ef5b7c72d42802e260f7ecc1b0e8d3772f4681bbef2aa7e9a963
5
5
  SHA512:
6
- metadata.gz: 6c5858894f02eb54b555df7ee182e81e3741cbd278e37bbd0a3250b9cfea62a00341d3ff95a75adb0d5f56cfd3abcdb036877bee28601b87ff060c3e9bf6f43c
7
- data.tar.gz: 0e99678f39920cd68026905ddd202ea8b9f9648c3bef9e941e7fd084fb2daa1ed843b5d2839fc10cbf13f1cc27c224ac212d7cd01173b2f3f8692706cadde2cb
6
+ metadata.gz: adc92b02ad90ae0afd4f4b10d146e26663d3dfd0d428f9739d9cfcf147dde7d2e09b05f84e956f116af62123477bc453f343ca3bda0a3bf17ae6d7edf61d7f35
7
+ data.tar.gz: 4a5720793e764bc4f366512b8d172b31d64b68c89abd86862d2d199f68bd36b590e706bba56c8fa5471d071c5d84e370c30de0b7bf93109df3476d75caf22dca
@@ -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.5)
20
+ concurrent-ruby (1.1.6)
21
21
  globalid (0.4.2)
22
22
  activesupport (>= 4.2.0)
23
- i18n (1.7.0)
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 (10.5.0)
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.5)
44
+ tzinfo (1.2.7)
45
45
  thread_safe (~> 0.1)
46
- zeitwerk (2.2.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 (~> 10.0)
60
+ rake (~> 13.0)
61
61
  sqlite
62
62
 
63
63
  BUNDLED WITH
@@ -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", "~> 10.0"
37
+ spec.add_development_dependency "rake", "~> 13.0"
38
38
  spec.add_development_dependency "sqlite"
39
39
  end
@@ -7,7 +7,6 @@ require "fixtury/version"
7
7
  require "fixtury/schema"
8
8
  require "fixtury/locator"
9
9
  require "fixtury/store"
10
- require "fixtury/execution_context"
11
10
 
12
11
  module Fixtury
13
12
 
@@ -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:, value:)
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
- execution_context_hooks(execution_context) do
56
+ provide_execution_context_hooks(execution_context) do |ctxt|
59
57
  if args.length.positive?
60
- execution_context.instance_exec(*args, &callable)
58
+ ctxt.instance_exec(*args, &callable)
61
59
  else
62
- execution_context.instance_eval(&callable)
60
+ ctxt.instance_eval(&callable)
63
61
  end
64
62
  end
65
63
  end
66
64
 
67
- def execution_context_hooks(execution_context)
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
@@ -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 || ::Fixtury::ExecutionContext.new
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fixtury
4
4
 
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
 
7
7
  end
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.1.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-07 00:00:00.000000000 Z
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: '10.0'
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: '10.0'
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