fixture_kit 0.13.0 → 0.14.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: 109e5fa3e9da5e57574f2942265e0a175d7eb7790b9958b645ac32c64384d08b
4
- data.tar.gz: 8082b4b0f1d2c39353aad564ffb4c1b918308b31675f847fc2cf93a6f0020ab2
3
+ metadata.gz: 1ec46a033864696a48fe4a196744b61dd142aeabee84a68f65554ccf698d4e72
4
+ data.tar.gz: 5e41645bf7246d12f8a0bbecb4bbad7bcb6f1f2dddab685fc6c32b459c2a3550
5
5
  SHA512:
6
- metadata.gz: dfb07fe354ed0a7eb8df7e52fd5807e994a7165579247ab73eebea1c30efe6d505ec7b86c6331c1144aaac652d9521e683fec5ed6a7f2c55c2b0bd83d308184b
7
- data.tar.gz: a1affc9ef20e4bdf533d51614e61ec85d56fd5f429606e83fc417611023bfd2511983a814a55f06c5c3396dd4a07de956b3e123e81cca536620da61797e23ded
6
+ metadata.gz: fd821fd991c0ded4d4d10f963ece4cde8740c55c88fce238cf0033adbb791e2e64b50b3257c82a6fecd93e8810cd068e49329361b26661dd4072c1287c618ae3
7
+ data.tar.gz: 416bed6e4889c63a5a860c55b45e3f525499682cd5367e712b365555361fd36bd561c3e0cd02259d32f969c9877a50d0f01c570f0159af68a01334f526968f2d
@@ -10,6 +10,10 @@ module FixtureKit
10
10
  @extends = extends
11
11
  end
12
12
 
13
+ def path
14
+ @definition.source_location.first
15
+ end
16
+
13
17
  def evaluate(context, parent: nil)
14
18
  context.singleton_class.prepend(mixin(parent))
15
19
  context.instance_exec(&@definition)
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FixtureKit
4
+ class Event
5
+ attr_reader :fixture
6
+
7
+ def initialize(fixture)
8
+ @fixture = fixture
9
+ end
10
+
11
+ def identifier
12
+ fixture.cache.identifier
13
+ end
14
+
15
+ def path
16
+ fixture.definition.path
17
+ end
18
+ end
19
+ end
@@ -46,9 +46,10 @@ module FixtureKit
46
46
  !identifier.is_a?(String)
47
47
  end
48
48
 
49
- def emit(event)
49
+ def emit(event_name)
50
+ fixture_event = Event.new(self)
50
51
  unless block_given?
51
- configuration.callbacks.run(event, @cache)
52
+ configuration.callbacks.run(event_name, fixture_event)
52
53
  return
53
54
  end
54
55
 
@@ -56,7 +57,7 @@ module FixtureKit
56
57
  elapsed = Benchmark.realtime do
57
58
  value = yield
58
59
  end
59
- configuration.callbacks.run(event, @cache, elapsed)
60
+ configuration.callbacks.run(event_name, fixture_event, elapsed)
60
61
  value
61
62
  end
62
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FixtureKit
4
- VERSION = "0.13.0"
4
+ VERSION = "0.14.0"
5
5
  end
data/lib/fixture_kit.rb CHANGED
@@ -15,6 +15,7 @@ module FixtureKit
15
15
  autoload :Callbacks, File.expand_path("fixture_kit/callbacks", __dir__)
16
16
  autoload :ConfigurationHelper, File.expand_path("fixture_kit/configuration_helper", __dir__)
17
17
  autoload :Singleton, File.expand_path("fixture_kit/singleton", __dir__)
18
+ autoload :Event, File.expand_path("fixture_kit/event", __dir__)
18
19
  autoload :Fixture, File.expand_path("fixture_kit/fixture", __dir__)
19
20
  autoload :Definition, File.expand_path("fixture_kit/definition", __dir__)
20
21
  autoload :Registry, File.expand_path("fixture_kit/registry", __dir__)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixture_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ngan Pham
@@ -163,6 +163,7 @@ files:
163
163
  - lib/fixture_kit/configuration.rb
164
164
  - lib/fixture_kit/configuration_helper.rb
165
165
  - lib/fixture_kit/definition.rb
166
+ - lib/fixture_kit/event.rb
166
167
  - lib/fixture_kit/file_cache.rb
167
168
  - lib/fixture_kit/fixture.rb
168
169
  - lib/fixture_kit/memory_cache.rb