Skip to content

Commit 6df9ce1

Browse files
committed
expose a better inspect value for Example::Procsy
1 parent 8698e28 commit 6df9ce1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/rspec/core/example.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ def initialize(example, &block)
220220
def wrap(&block)
221221
self.class.new(example, &block)
222222
end
223+
224+
# @private
225+
def inspect
226+
@example.inspect.gsub('Example', 'ExampleProcsy')
227+
end
223228
end
224229

225230
# @private

spec/rspec/core/hooks_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,21 @@ def self.data_from(ex)
181181
expect(data_1).to eq(expected_data)
182182
expect(data_2).to eq(expected_data)
183183
end
184+
185+
it "exposes a sensible inspect value" do
186+
inspect_value = nil
187+
group = ExampleGroup.describe do
188+
around do |ex|
189+
inspect_value = ex.inspect
190+
end
191+
192+
it "does something" do
193+
end
194+
end
195+
196+
group.run
197+
expect(inspect_value).to match /ExampleProcsy/
198+
end
184199
end
185200

186201
context "when running the example within a block passed to a method" do

0 commit comments

Comments
 (0)