selective-ruby-rspec 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9dabf9ac9269df064cd915e2057ce8269be4afc4baad3233914558721f021fa
4
- data.tar.gz: c99dc709ee39e4ecd4f5d20d24fbf09483d65add4885c50673b17ad6a78c7f84
3
+ metadata.gz: 28d546ae7d10547709d4b3180b1b52851d9ba8ab1f9e9f819d5b49abcde56136
4
+ data.tar.gz: 1037b6b16f88ab08b67a51d4176f4d41d0ef43c7693793b8886b1e93f1c01dbe
5
5
  SHA512:
6
- metadata.gz: d40b5120cae8e625e16073729b8135d29f5baea07c7127b0375fcb9b39c43cd794df334d8c2b26b9c50c6ddc1e16471297a9372fa1b56e36709c3144cb831cfe
7
- data.tar.gz: 42ee861ef501c3e9fd9fb44d325bbd33a4a8fcf5f5c627f7f9b426f4503a87728f75aafb418d4ba99eb98a6d4b915bc3cc7203f087f27711ba2655767a493d99
6
+ metadata.gz: c50265ba4980fc2d49b2cca5eff7320b7ed6357d9ce03153b10e0bc8a3a1e180a6d65ec9645da1d89ff5fbc8eadecd3bbebd97150fe927e5d5354f94f1151786
7
+ data.tar.gz: 29995bbfea2b82f9ffc3fb3996b3d35138ba9a95bee280e70d4adb0a5e73aaed1e83e3d2856b97909ccecfaa909fccfe76d4561e34d3c4665e7fbb25970354ab
@@ -139,6 +139,17 @@ module Selective
139
139
  end
140
140
  end
141
141
 
142
+ module Hooks
143
+ hooks = %i(before prepend_before after append_after)
144
+
145
+ hooks.each do |hook|
146
+ define_method(hook) do |*args, &block|
147
+ args = args.map { |a| a == :all ? :each : a }
148
+ super(*args, &block)
149
+ end
150
+ end
151
+ end
152
+
142
153
  def self.apply
143
154
  ::RSpec::Support.require_rspec_core("formatters/base_text_formatter")
144
155
 
@@ -148,6 +159,12 @@ module Selective
148
159
  .prepend(Selective::Ruby::RSpec::Monkeypatches.const_get(module_name))
149
160
  end
150
161
 
162
+ # We'd like to prepend to ::RSpec::Core::Hooks here but there is
163
+ # a bug in < Ruby 3.0 that prevents us from doing so. Instead,
164
+ # we extend the ExampleGroup class which is where the Hooks module
165
+ # is included.
166
+ ::RSpec::Core::ExampleGroup.extend(Hooks)
167
+
151
168
  ::RSpec.singleton_class.prepend(RSpec)
152
169
  ::RSpec::Core::Reporter.prepend(Reporter)
153
170
  ::RSpec::Core::Configuration.prepend(Configuration)
@@ -12,8 +12,6 @@ module Selective
12
12
  DEFAULT_SPEC_PATH = "./spec"
13
13
 
14
14
  def initialize(args)
15
- require "rspec/core"
16
-
17
15
  Selective::Ruby::RSpec::Monkeypatches.apply
18
16
  apply_rspec_configuration
19
17
 
@@ -3,7 +3,7 @@
3
3
  module Selective
4
4
  module Ruby
5
5
  module RSpec
6
- VERSION = "0.1.1"
6
+ VERSION = "0.1.3"
7
7
  end
8
8
  end
9
9
  end
@@ -1,10 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "zeitwerk"
4
+ require "rspec/core"
4
5
 
5
6
  loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
6
7
  loader.inflector.inflect("rspec" => "RSpec")
7
8
  loader.ignore("#{__dir__}/selective-ruby-rspec.rb")
9
+ loader.ignore("#{__dir__}/selective/ruby/rspec/version.rb")
8
10
  loader.setup
9
11
 
10
12
  require "selective-ruby-core"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selective-ruby-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Wood
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-12-02 00:00:00.000000000 Z
12
+ date: 2023-12-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: zeitwerk