selective-ruby-rspec 0.1.0 → 0.1.1

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: c3d785a9a11a8a066d3aed92bcdecda6f1cb52aa08eebc726c3697d194fb9205
4
- data.tar.gz: 83ebdde2f7d64514c3465ed69981b576ab0bbe8cbeb0a9aea38b2dfa9d34b09e
3
+ metadata.gz: f9dabf9ac9269df064cd915e2057ce8269be4afc4baad3233914558721f021fa
4
+ data.tar.gz: c99dc709ee39e4ecd4f5d20d24fbf09483d65add4885c50673b17ad6a78c7f84
5
5
  SHA512:
6
- metadata.gz: f7b08bb3a657876e3bff4699d555769eba60e2ebd144ed7b25f765aa235463bb17173eacf456f6422f97d0e082f5f4c6c692eaa5237c8cac1f15ce64e43135f6
7
- data.tar.gz: 8e59c41dba74ba550001d117d717d04e0b20e7f02f57040e3bb176040c3a92c5db1fb843aea2baf0ebbd6c7a64ef94e31c64d2dd31238c87efa0797516c120aa
6
+ metadata.gz: d40b5120cae8e625e16073729b8135d29f5baea07c7127b0375fcb9b39c43cd794df334d8c2b26b9c50c6ddc1e16471297a9372fa1b56e36709c3144cb831cfe
7
+ data.tar.gz: 42ee861ef501c3e9fd9fb44d325bbd33a4a8fcf5f5c627f7f9b426f4503a87728f75aafb418d4ba99eb98a6d4b915bc3cc7203f087f27711ba2655767a493d99
@@ -5,7 +5,8 @@ module Selective
5
5
  MAP = {
6
6
  "BaseTextFormatter" => [:message, :dump_pending, :seed, :close],
7
7
  "ProgressFormatter" => [:start_dump],
8
- "DocumentationFormatter" => [:message]
8
+ "DocumentationFormatter" => [:message],
9
+ "ProfileFormatter" => [:dump_profile]
9
10
  }
10
11
 
11
12
  MAP.each do |module_name, methods|
@@ -67,6 +68,26 @@ module Selective
67
68
  def get_files_to_run(*args)
68
69
  super.reject { |f| loaded_spec_files.member?(f) }
69
70
  end
71
+
72
+ def with_suite_hooks
73
+ return yield if dry_run?
74
+
75
+ unless @before_suite_hooks_run
76
+ ::RSpec.current_scope = :before_suite_hook
77
+ run_suite_hooks("a `before(:suite)` hook", @before_suite_hooks)
78
+ @before_suite_hooks_run = true
79
+ end
80
+
81
+ yield
82
+ end
83
+
84
+ def after_suite_hooks
85
+ return if dry_run?
86
+
87
+ ::RSpec.current_scope = :after_suite_hook
88
+ run_suite_hooks("an `after(:suite)` hook", @after_suite_hooks)
89
+ ::RSpec.current_scope = :suite
90
+ end
70
91
  end
71
92
 
72
93
  module World
@@ -85,7 +106,7 @@ module Selective
85
106
  module Example
86
107
  def initialize(*args)
87
108
  super
88
- ::RSpec.world.example_map[id] = example_group
109
+ ::RSpec.world.example_map[id] = example_group.parent_groups.last
89
110
  end
90
111
 
91
112
  def run(*args)
@@ -108,6 +129,16 @@ module Selective
108
129
  end
109
130
  end
110
131
 
132
+ module RSpec
133
+ unless ::RSpec.respond_to?(:current_scope)
134
+ def current_scope=(scope)
135
+ # No-op! Older versions of RSpec don't have this method.
136
+ # so we're adding it here if it's not defined since our
137
+ # monkeypatching references it.
138
+ end
139
+ end
140
+ end
141
+
111
142
  def self.apply
112
143
  ::RSpec::Support.require_rspec_core("formatters/base_text_formatter")
113
144
 
@@ -117,12 +148,13 @@ module Selective
117
148
  .prepend(Selective::Ruby::RSpec::Monkeypatches.const_get(module_name))
118
149
  end
119
150
 
120
- ::RSpec::Core::Reporter.prepend(Selective::Ruby::RSpec::Monkeypatches::Reporter)
121
- ::RSpec::Core::Configuration.prepend(Selective::Ruby::RSpec::Monkeypatches::Configuration)
122
- ::RSpec::Core::World.prepend(Selective::Ruby::RSpec::Monkeypatches::World)
123
- ::RSpec::Core::Runner.prepend(Selective::Ruby::RSpec::Monkeypatches::Runner)
124
- ::RSpec::Core::Example.prepend(Selective::Ruby::RSpec::Monkeypatches::Example)
125
- ::RSpec::Core::Metadata::HashPopulator.prepend(Selective::Ruby::RSpec::Monkeypatches::MetaHashPopulator)
151
+ ::RSpec.singleton_class.prepend(RSpec)
152
+ ::RSpec::Core::Reporter.prepend(Reporter)
153
+ ::RSpec::Core::Configuration.prepend(Configuration)
154
+ ::RSpec::Core::World.prepend(World)
155
+ ::RSpec::Core::Runner.prepend(Runner)
156
+ ::RSpec::Core::Example.prepend(Example)
157
+ ::RSpec::Core::Metadata::HashPopulator.prepend(MetaHashPopulator)
126
158
  end
127
159
  end
128
160
  end
@@ -76,6 +76,7 @@ module Selective
76
76
  end
77
77
 
78
78
  def finish
79
+ rspec_runner.configuration.after_suite_hooks
79
80
  ::RSpec.world.reporter.finish
80
81
  end
81
82
 
@@ -3,7 +3,7 @@
3
3
  module Selective
4
4
  module Ruby
5
5
  module RSpec
6
- VERSION = "0.1.0"
6
+ VERSION = "0.1.1"
7
7
  end
8
8
  end
9
9
  end
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.0
4
+ version: 0.1.1
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-11-03 00:00:00.000000000 Z
12
+ date: 2023-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: zeitwerk